Memory usage of an activity / thread

by Zonakusu » Tue, 20 Oct 2009 18:17:56 GMT

Sponsored Links
 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

Intent detailIntent = Profile.mActivity.getIntent();

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 :)

Other Threads

1. Status Bar Customizations

I've seen this posted before however I'd really like to revisit it. In
dealing with a small res device I would like to hide the status bar,
my current solution has been to make it transparent and 'make a mess'
of the framework and xml so that certain icons are no longer shown,
for example the battery icon only shows a png when it's low, the
ticker font is transparent etc.

   I'd much rather do this the proper way, via the source in android
 So who has ideas for;

 Making the status bar hide when the launcher is open?
 not having the notification ticker at all?

 Disabling the status bar completely?

 What are your thoughts everyone?


2. Can I modify vitual keyboard's preview popup?

hi all~!

now i study inputmethod(virtual keyboard).

Can I modify vitual keyboard's preview popup?

somebody help me!

What method do i looking for?



3. How can i integrate facebook connect api in any android application?

4. Cyanogen and Signed Apps Issue

5. deleteOnExit when and how does an Android JVM exit

6. UsefulMod v2.2 @ Samsung Spica XXJC

7. OpenGL ES flickering problems?