LHA
LHA

Reputation: 9655

DialogFragment vs Activity with Dialog theme

I understand that both Dialog-fragment and Activity with Dialog theme can be used to create Dialog in Android. I also understand that both they survive during Orientation changed.

My question is can I always use Activity with Dialog theme for all my dialogs? Is there any case I have to use DialogFragment instead of Activity with dialog theme?

Thank you!

Upvotes: 4

Views: 1210

Answers (1)

user3078555
user3078555

Reputation:

If you use Activity with dialog theme, you can use ActionBar. You can't use ActionBar with Dialog. Android does not provide anyway to add menu/action into Dialog title. You have to implement its yourself.

Dialog is like a Sub-view of Activity so if you use Dialog, you don't have to handle Orientation changed. Communication between Activity and Dialog like a View and Sub-view. This is not true for communication between Activity and Dialog theme-activity.

Choose Dialog Or Dialog themed activity depends your dialog nature/complexity.

Upvotes: 3

Related Questions