I would like to know what methods are similar to onPause()
and onResume()
but in a class that extends Dialog.
I want to know to register a broadcastReciver registerReceiver(broadcast)
and to unregister it unregisterReceiver(broadcast)
. In a normal activity I would do it by overriding the methods onPause()
and onResume()
but in a dialog I don't know exactly where it would be correct to do it.
From what I see in the official documentation, the Dialog class has the "onStart" and "onStop" methods in addition to "onCreate" https://developer.android.com/reference/android/app/Dialog.html
Any of them should work for you.
In a Dialog there are no methods
onPause()
andonResume()
these are handled by the Activity that creates the Dialog.In both cases the methods
onPause()
andonResume()
if you want to use them, would be those of theActivity
one that creates theDialog
orDialogFragment
.