Issue
I have an unusual problem. I have a simple activity, which includes nine buttons with background images and background to the main layout.
I run my apps on my Nexus, one which is pretty fast, so I never had problem with the app. Until I updated to Android 2.3.3 (Gingerbread). My app won't run and force closes. Then I deleted the code below,
this.getWindow().setBackgroundDrawableResource(R.drawable.image);
And the app ran fine with no problems. It turned out that the image that I was using was too big, and Android 2.3.3 is somehow slower than Android 2.2. So I used image.png rather than image.jpg, which solved the problem for Nexus One phones. However, the slower phones won't run my app still cause its taking too long to create the activity. So the main Thread is timing out causing the app to crash. What can I do it in this case?
Solution
I finally found the problem. The VM was running out of memory due to the large size of the image.
Each app has 16 MB of memory to play with. If you exceed 16 MB the app will crash. Nexus One has 28 MB of memory for each app.
Answered By - Mark Ismail
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.