If you have out of memory errors and you are displaying toast
messages, read on...

I noticed displaying a toast message can prevent an Activity from
being garbage collected correctly. Trying to restart an activity
throws an out of memory error (my activity uses bitmap images). I can
only assume that a toast message does not terminate its toast display
thread (?) resulting in an activity not being able to garbage collect?

Code:

Toast toast = Toast.makeText(GameActivity.this, text,
Toast.LENGTH_SHORT);
toast.setGravity(Gravity.TOP, 0, 30);
toast.show();

Commenting out "toast.show()" fixes the problem.



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to