android - when do I need to use dialogfragments -
i have fragment button after pressing button should open alertdialog has 2 buttons images, 1 image each button (no text on buttons). 1 dialog button opens gallery pick photo , pass fragment other opens camera take photos , pass same fragment. should use dialogfragment or can create alertdialog in fragment , ok? don't when need use dialogfragments
"dialogfragment various things keep fragment's lifecycle driving it, instead of dialog. note dialogs autonomous entities -- own window, receiving own input events, , deciding on own when disappear (by receiving key event or user clicking on button)."
source : dialog fragments | android developers
"this easy.
dialogfragment fragment. can fragment provide while other objects can't?
it's lifecycle callbacks.
so dialogfragment, can powerful , makes code cleaner.
have ever seen window leaks if didn't close dialog when activity getting destroyed? prevent that, have ever tried close dialog when onpause() called? that, have ever had make reference of dialog class level object?
with dialogfragment, it's handled. , lifecycle callbacks. can provide more intelligence dialog , make smart work on own rather activity telling do."
source : koreandude | stackoverflow
Comments
Post a Comment