I see many developers choosing to theme their activity as a dialog instead of using the android dialog and customize it.
I searched on the internet for this answer but couldn’t find it.
Could someone give me the pro’s and con’s of the activity theme method? Of course, it gives you more freedom but are there any styling reasons to avoid customizing the standard dialog?
I, myself needed to re-use fragments in dialogs so I created a themed activity to comfort my needs but now I’m running into trouble at retrieving results from the themed activity.
Thanks in advance.
Bram
1) Start your activity using startActivityForResult.
2) Before you close your dialog-styled activity add needed data to intent extras and save it using SetResult(int, intent).
3) To process results add code to anActivityResult of parent activity that will retrieve data from saved intent.
no probs.
Yes, if you need to add heavy custom logic to your “dialog”, then usage of styled activity is preferable.
In case of simple alerts – use Dialog.