Working with DialogFragment

In this chapter, we already covered how to use the fragment and ListFragment to optimize layout for Android tablets. Let's now discuss another specialized fragment subclass, DialogFragment. The current implementation of the POIApp uses AlertDialog to display the confirmation dialog to a user before deleting the POI. In this section, we will replace the AlertDialog implementation with DialogFragment.

DialogFragment is used to display a fragment as a floating dialog window that pops up on top of the current window. DialogFragment is the subclass of fragment and was introduced in Android 3.0 API level 11. Google recommends that you use DialogFragment for implementing the dialog because of the following reasons:

  • Like normal ...

Get Xamarin Mobile Application Development for Android - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.