My application shows an AlertDialog with a ListView inside. Everything worked fine bun then I decided to test this for memory leaks. After running
I had run your code and when I first press the button it is showing the LeakedActivity with dialog and onClick it is removing dialog but the activity remains in foreground with black screen. On pressing back key and then again starting the activity it is showing the memory out of error exception:
ERROR/AndroidRuntime(263): java.lang.OutOfMemoryError
Then I removed the line private final byte[] junk = new byte[10*1024*1024]; from the dialog code after that no such problem exists....don't know why if anyone can put this thing in words, thanks to him/her..
I tested the code in emulator android 2.1