Advice for Android Image Processing, Page 3
Some Advice for Android Image Processing
Before you jump into image Android image processing, here are some pointers to keep in mind:
- If it takes too long to process all the image pixels (approximately five seconds), you could get a popup dialog called Application Not Responding or ANR. You should create a child thread and do the complicated calculation there. That should keep the main thread running without interruption.
- If the child thread needs to change the main view (called UI thread), you should use a message handler in the main thread to listen for the notification from the child thread and then update the view accordingly. A child thread cannot modify the view in the main UI thread directly.
- Some enhancements can be made. For example, it can be modified to read the image file from browsing the folders or from a URL. Image animation can be done carefully through multi-threading and message handling along with rectangle clipping to produce smooth transition effects.
Conclusion
Hopefully, the information provided here has given you a rough idea of how Android image processing works. I hope you develop a neat image application for the Android platform with your own unique style. From Eclipse, you can create a new Android project by selecting "Creating project from existing source" and browse to the folder where the sample project is decompressed to.
References
- Download and save the entire software project
- Android Developers at: http://developer.android.com/
- Rafael C. Gonzalez and Richard E. Woods, Digital Image Processing, Addison-Wesley Publishing, 1994
About the Author
Chunyen Liu has been a software professional for many years. Some of his applications were among winners at programming contests administered by SUN, ACM and IBM. He has also co-authored U.S. patents, written articles, and reviewed books for various publishers. He holds advanced degrees in Computer Science and has written numerous hobby apps at Androidlet and The J Maker. On the non-technical side, he is a tournament-ranked table tennis player, certified umpire, and certified coach of USA Table Tennis.
Page 3 of 3
This article was originally published on January 9, 2012