Reputation: 14658
If you have an activity and you need to display some sort of square overlay which has buttons. Why would you use dialog over nested layout with setVisibility ?or vice versa ?
Upvotes: 1
Views: 28
Reputation: 23665
If you're using a nested layout, you'd need to put all the logic for what's going on in that 'dialog', into the Activity as well. On the other hand, if you have a dialog you can put that logic in that separate class, which makes it easier to reuse it elsewhere (think DatePickerDialog etc.) Also, when showing a dialog, the system automatically does the work of shading down and blocking the rest of the UI, handling of back button functionality etc.
But in general, you can also use a nested layout instead of a dialog. You can also overcome some above mentioned shortcomings by implementing a custom view and putting your dialog logic there.
Upvotes: 1