Memory usage is a big isue when programming for android. When I
created the base of the application I'm currently building, I just
tested the part (activity) that I just worked on. Last week the base
was done so I could focus on other things, including performance.

My application crashed (OutOfMemory) pretty fast when I - for example
- first opened a MapActivity followed by an activity that uses the
Camera and some Bitmaps/BitmapFactory. Now a week later I optimized
much code and it doesnt crash that fast, but it still does. I started
with a max of 2 pictures until crash, now I can make up to 15 pictures
until it crashes.

One thing that caught my eye was the threading of the application.
Each time when I create a picture and return to my main activity, it
creates a new thread (at least thats what the DDMS is showing me).
Isn't this bad for memory usage?

The way I call the main activity (Profile) from the picture activity
(PreviewPicture).

Intent detailIntent = Profile.mActivity.getIntent();
PreviewPicture.mActivity.startActivity(detailIntent);
PreviewPicture.mActivity.finish();

Note: I use mActivity in PreviewPicture because this code is called
from a dialog.

This is very weird, because when I (re)open another activity like
PreviewPicture the same way, it doesnt add a thread in the DDMS.

Since BitmapFactory leaks memory I assume it will be very hard to
completely remove the posiblilty of crashing by a
OutOfMemoryException, but I want it to be as stable as possible.

I hope you guys can help me :)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to