Android Dialog rejection

When you call dismiss() in a dialog box, in addition to hiding it, does it also delete it from memory? Does it remove all objects that were placed inside the dialog box, such as ImageViews , Buttons , etc. From memory?

Is there a way so that I can free the memory of these objects myself and not wait for the garbage collector to do this?

+4
source share
4 answers

No, I believe dismiss() just hides it.

Here's a link

removeDialog(int) will clear the state.

+4
source

There can only be Free Garbage Collector in java memory, and you can only set this object to zero so that the garbage collector can free memory.

Why do you need this? The whole point of Java is that it takes care of memory management for you. Do you have some memory problems or something else?

+1
source

Google Android Developer Documentation:

public void dismiss (): Because: API level 1 Disable this dialog by removing it from the screen. This method can be safely called from any thread. Note that you should not override this method to clear when the dialog is rejected; instead, implement this in onStop ().

+1
source

In manual mode, free memory area

  • Cannot run Java. You can allocate memory with new , but the garbage collector will take care of freeing it.

  • It's a bad idea when you have a garbage collector trying to work behind.

dismiss() just hides the dialog. Call removeDialog(int) to remove all references to it and wait for the GC to start.

+1
source

All Articles