An Android Fragment that displays a dialog window, floating on top of its activity's window.
Questions tagged [dialogfragment]
444 questions
81
votes
9 answers
Detect back button but don't dismiss dialogfragment
I have a dialogfragment for a floating dialog which includes a special keyboard that pops up when a user presses inside an EditText field (the normal IME is stopped from being displayed).
I would like the keyboard to be dismissed (visibility = GONE)…
![](../../users/profiles/3227652.webp)
user3227652
- 811
- 1
- 6
- 4
70
votes
2 answers
DialogFragment advantages over AlertDialog
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:…
![](../../users/profiles/420700.webp)
Raphael Petegrosso
- 3,820
- 2
- 21
- 27
46
votes
5 answers
Change DialogFragment enter/exit transition at just before dismissing
I have a DialogFragment and I set animation for enter/exit in the onActivityCreated method as below:
@Override
public void onActivityCreated(Bundle arg0) {
super.onActivityCreated(arg0);
getDialog().getWindow()
…
![](../../users/profiles/3659937.webp)
Dominic D'Souza
- 891
- 1
- 7
- 16
42
votes
6 answers
BottomSheetDialogFragment - listen to dismissed by user event
How can I listen to a FINAL dismissal of a BottomSheetDialogFragment? I want to save user changes on the final dismissal only...
I tried following:
Method 1
This only fires, if the dialog is dismissed by swiping it down (not on back press or on…
![](../../users/profiles/1439522.webp)
prom85
- 14,805
- 15
- 98
- 206
35
votes
3 answers
commitAllowingStateLoss on DialogFragment
I have an IllegalStateException on showing a DialogFragment :
java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
i know why its happening but i want to using commitAllowingStateLoss on showing dialog by…
![](../../users/profiles/1640031.webp)
Arash GM
- 9,996
- 6
- 54
- 73
27
votes
4 answers
getViewLifecycleOwner() in DialogFragment leads to crash
I use DialogFragment (onCreateDialog) and ViewModel for it. But, when I try to pass getViewLifecycleOwner() to the LiveData::observe method I get the error below:
java.lang.IllegalStateException: Can't access the Fragment View's LifecycleOwner when…
![](../../users/profiles/5228569.webp)
Alex.Marynovskyi
- 816
- 1
- 12
- 19
22
votes
3 answers
What is lifecycle of DialogFragment
I could not find proper lifecycle of android.support.v4.app.DialogFragment by searching on Google. I need this for some implementation. As we know DialogFragment has some methods same like Dialog.
DialogFragment extends Fragment so its lifecycle is…
![](../../users/profiles/6891563.webp)
Khemraj Sharma
- 46,529
- 18
- 168
- 182
19
votes
2 answers
Dialog Fragment with wrap_content coming as a full screen. How to make it as a height of layout and not a full screen?
I have created a custom dialog fragment and its xml as follows:
![](../../users/profiles/713360.webp)
ravindra.kamble
- 1,023
- 3
- 11
- 20
17
votes
2 answers
How to correctly use Android View Binding in DialogFragment?
What is correct way of using Android View Binding in DialogFragment()?
Official documentation mentions only Activity and Fragment:
https://developer.android.com/topic/libraries/view-binding
![](../../users/profiles/2907294.webp)
Lera
- 826
- 1
- 13
- 29
16
votes
8 answers
Get value from Bottom Sheet Dialog Fragment
I'm starting bottomSheetDialogFragment from a fragment A.
I want to select the date from that bottomSheetDialogFragment then set it in the fragment A.
The select date is already done, I just want to get it in the fragment A to set it in some…
![](../../users/profiles/8898641.webp)
Abdulrahman
- 251
- 1
- 3
- 11
13
votes
2 answers
DialogFragment not showing after adding Alert Window
I have a function that when triggered, succesfully displays a DialogFragment with the following code
DialogFragment
DialogFragment dialog;
View dialogView;
Context activityContext;
...
dialog = new DialogFragment(){
@Override public Dialog…
![](../../users/profiles/2081874.webp)
Maw Boc
- 151
- 7
13
votes
5 answers
DialogFragment without FragmentActivity
Is it possible to use a DialogFragment when using an Activity instead of a FragmentActivity? The show() methods needs a FragmentManager.
I want to implement a Dialog which contains just one EditText, and the tutorials on android developers says I…
![](../../users/profiles/2184584.webp)
Christopher Francisco
- 13,553
- 23
- 77
- 181
13
votes
2 answers
Android: disable DialogFragment OK/Cancel buttons
How can I disable OK/Cancel button of a DialogFragment when it is created using an AlertDialog ?
I tried calling myAlertDialogFragment.getDialog() but it's always returning null even once the fragment is displayed
public static class…
![](../../users/profiles/1026605.webp)
user1026605
- 1,414
- 3
- 22
- 50
12
votes
1 answer
Dialogs and Popups in Android
The Android design documentation in http://developer.android.com/design/building-blocks/dialogs.html makes a clear differentiation between Dialogs, Alerts, Popups and Toasts. It also recommends the implementation of Dialogs by means of the…
![](../../users/profiles/2482894.webp)
leo9r
- 1,882
- 23
- 28
12
votes
2 answers
Android: NullPointerException at DialogFragment.dismissInternal at DialogFragment.dismissAllow
Crash app when show ProgressDialog. I'm testing on my phone with a slide-out keyboard. When dialog is show I slide keyboard and app crashes.
public static class ProgressDialogFragment extends DialogFragment
{
public ProgressDialogFragment()
…
![](../../users/profiles/1985164.webp)
Viacheslav
- 521
- 10
- 21