Questions tagged [android-dialog]

Base class for Dialogs. A dialog in Android is a small window that prompts the user to make a decision or enter additional information. A dialog does not fill the screen and is normally used for modal events that require users to take an action before they can proceed.

A dialog is usually a small window that appears in front of the current Activity. The underlying Activity loses focus and the dialog accepts all user interaction. Dialogs are normally used for notifications that should interrupt the user and to perform short tasks that directly relate to the application in progress (such as a progress bar or a login prompt).

Official Android Dialog Documentation

1460 questions
28
votes
2 answers

Change background of ProgressDialog

I am trying to change the background of a ProgressDialog. I searched the net and found various suggestions (like How to remove border from Dialog?), but I am unable to replace the actual background of the ProgressDialog. Instead I get another…
aha
  • 3,702
  • 3
  • 38
  • 47
26
votes
5 answers

Android: How to override onBackPressed() in AlertDialog?

I have an AlertDialog dlgDetails which is shown from another AlertDialog dlgMenu. I would like to be able to show dlgMenu again if the user presses the back button in dlgDetails and simply exit the dialog if he presses outside the dialog. I think…
Pooks
  • 2,565
  • 3
  • 37
  • 40
26
votes
5 answers

Jetpack Compose Fullscreen Dialog

I tried to make a fullscreen dialog using Jetpack Compose using this code: Dialog(onDismissRequest = { /*TODO*/ }) { NewPostDialog() } It ended up looking something like this. How can I remove the margin at the side (marked red)?
Yannick
  • 4,833
  • 8
  • 38
  • 63
24
votes
7 answers

Android make a dialog appear in fullscreen

I need the dialog to fill the screen except for some space at the top and the bottom. I've search for a solution but couldn't find one probably because I'm declaring it in an onClickListener. Can someone please give a solution? Activity…
Mihai Bratulescu
  • 1,915
  • 3
  • 27
  • 43
24
votes
3 answers

Android: indeterminate horizontal progress (dialog) bar

What's the best way to create an indeterminate, horizontal progress bar? If I do this, dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); dialog.setIndeterminate(true); I still get the progress numbers (percent, etc) along the…
Jeffrey Blattman
  • 22,176
  • 9
  • 79
  • 134
22
votes
2 answers

Correct way to make a custom material dialog with appCompat 23+

Ok I'm really confused here on how to make a custom dialog properly using the latest appcompat v23.0.1 Here is a couple of ways First way: public class AddTipDialogFrag extends DialogFragment { @Override public Dialog onCreateDialog(Bundle…
21
votes
2 answers

Android close custom dialog

I am trying to get the custom dialog to close on button press //set up dialog Dialog dialog = new Dialog(BrowseActivity.this); dialog.setContentView(R.layout.about); dialog.setTitle("This is my custom dialog box"); …
user639410
  • 387
  • 1
  • 3
  • 9
20
votes
5 answers

inside Android Dialog, how to setup onActivityResult for startActivityForResult?

From an activity, I can easily setup the onActivityResult() and call startActivityForResult() and everything works fine. Now, I need to call startActivityForResult() from the Dialog. But I can't setup the onActivityResult(), I believe Dialog is…
tony-p-lee
  • 797
  • 1
  • 7
  • 13
20
votes
2 answers

About Android Progress Dialog. Avoid?

I was reading about Dialogs in Android site and I came across a section that saying "Avoid ProgressDialog". Here is the link: http://developer.android.com/guide/topics/ui/dialogs.html does that means they recommend not to use it? I really need a…
20
votes
1 answer

Customizing dialog by extending Dialog or AlertDialog

I want to make a custom Dialog. Because I don't like its style, I want to have rounded rectangle rather than sharp corners. I know how to implement it by theme in AndroidManifest.xml, for example, I…
pengwang
  • 19,536
  • 34
  • 119
  • 168
19
votes
3 answers

DialogFragment buttons color change in Lollipop

I would like my Fragments to look consistent with the rest of the app and color palette which I applied so I would like to change the colors not only of title, but also of positive/negative buttons: I tried to do this like this, but unfortunetaly…
19
votes
1 answer

AlertDialog with positive button and validating custom EditText

I have created simple AlertDialog with positive and negative buttons. Positive button has registered DialogInterface.OnClickListener, where I get EditText value. I have to validate it (for example if it has to be not null) and if value is not…
hsz
  • 148,279
  • 62
  • 259
  • 315
19
votes
4 answers

Android: Display custom dialog in center of the container

How to display custom dialog as a center of the container? Dialog customdialog = new Dialog(this,android.R.style.Theme_Translucent_NoTitleBar); Window window = customdialog.getWindow(); window.setLayout(LayoutParams.FILL_PARENT,…
Kamal
  • 195
  • 1
  • 1
  • 9
18
votes
4 answers

What's wrong with the ICS Holo Dialog theme?

I've come across a bit of a weird issue with activities using the Holo Dialog theme (@android:style/Theme.Holo.Dialog) in Ice Cream Sandwich. It seems like they ignore their layouts and fill the entire screen instead of the layout width and height…
18
votes
3 answers

How to show Dialog Box from the class which extends Application in android?

I want show a dialog box after specific condition , but for demo right now I want show a Dialog Box from the class which extends Application . here is my code public class ControlApplication extends Application { @Override { …
shankey
  • 333
  • 2
  • 7
  • 18
1 2
3
97 98