Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8954537
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T14:20:07+00:00 2026-06-15T14:20:07+00:00

When developing an Android app, I’ve read that it’s recommended to use DialogFragment instead

  • 0

When developing an Android app, I’ve read that it’s recommended to use DialogFragment instead of using directly an AlertDialog to show alerts and confirmations.

This is done, for example, on DialogFragment’s Documentation: http://developer.android.com/reference/android/app/DialogFragment.html

People also say they prefer this here:
Android DialogFragment vs Dialog

I would like to know the advantages of this approach, since the code becomes more complex.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T14:20:07+00:00Added an answer on June 15, 2026 at 2:20 pm

    Use DialogFragment over Dialog:


    • Since the introduction of API level 13:

      the showDialog method from Activity is deprecated.
      Invoking a dialog elsewhere in code is not advisable since you will have to manage the dialog yourself (e.g. orientation change). Not using the showDialog will result in occasional exceptions, the dialog is not linked to any Activity.

      Note about showDialog:

      reference of Dialog: Activities provide a facility to manage the creation, saving and restoring of dialogs. See onCreateDialog(int), onPrepareDialog(int, Dialog), showDialog(int), and dismissDialog(int). If these methods are used, getOwnerActivity() will return the Activity that managed this dialog.

    • Difference between DialogFragment and AlertDialog

      One thing that comes to mind when reading your question. Are they so much different?
      A DialogFragment is pretty similar to a Dialog, it’s just wrapped inside a fragment. From Android reference regarding DialogFragment:

      A DialogFragment is a fragment that displays a dialog window, floating on top of its
      activity’s window. This fragment contains a Dialog object, which it
      displays as appropriate based on the fragment’s state. Control of the
      dialog (deciding when to show, hide, dismiss it) should be done
      through the API here, not with direct calls on the dialog.

    • Other notes

      • Fragments are a natural evolution in the Android framework due to the diversity of devices with different screen sizes.
      • DialogFragments and Fragments are made available in the support library which makes the class usable in all current used versions of Android.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Currently I'm developing an Android app for that I'm using the Facebook SDK. It's
I've been developing an Android app using Eclipse and the Android plug-in for Eclipse
i am developing an android app using phonegap. I have trouble displaying special characters
I' m developing an Android app wich requires me to use a Database. After
I was developing android app on eclipse till now and now I'm using Mono
I'm in the middle of developing android app using google map. My question is
I am developing an Android app (see screenshots). I have a layout that looks
I am developing an Android app (see screenshots). I have a layout that looks
I am developing Android app on Eclipse using a Windows environment with ADT. I
I'm developing an Android App using PhoneGap, but I found a problem very soon.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.