I have been developing android application since last 8 months. During that time I faced a lot of weird problems which wasted a lot of time and created a lot mental pressure on me. No I always try to keep in mind on those things before coding for android application. Let’s discuss some of those things…..
1. First of all I faced problem when I tried to work with functionality which takes a lot of time to finish execution( i.e parsing a web url response content). It caused ANR (application not responding). Android recommendation was to use asynchronus task for heavy process (http://developer.android.com/reference/android/os/AsyncTask.html) . It is really simple to understand. But as beginner I wasted time to figure out it.
2. Second problem was to update the UI from background function/thread. There is a nice technique for this, use runOnUiThread() method for updating the UI instead from background thread.
3. Most time wasting issue was working with networking on android device specially with WIFI. If you use wifi for net connection or communicate through wifi wireless device/router don’t forget to wait until there is valid DHCP is assigned to your android phone/device. I was tried to do stuff as soon as wifi is enabled checking the network is available. Though there is a method for checking network availablity that made me a real fool for a long period of time. It shows that network is available but still the valid DHCP is not assigned.
4. The most dangerous issue I faced was “Virtual machine memory budget issue”. I worked on multiple IP camera streaming. First stage of development memory budget issue was occurring frequently and the app was crashing unexpectedly. There were so many threads and about 4 input streaming is closed at the same time and I found that if the heap memory size exceeds more than 10 MB (Android 1.6) then memory issue occurs. So when working with stream and graphics care should be taken that the app doesn’t hold up much heap memory.