Questions tagged [android-alertdialog]

A subclass of Dialog that can display one, two or three buttons. If you only want to display a String in this dialog box, use the setMessage() method.

A subclass of Dialog that can display one, two or three buttons. If you only want to display a String in this dialog box, use the setMessage() method. If you want to display a more complex view, look up the FrameLayout called "custom" and add your view to it:

FrameLayout fl = (FrameLayout) findViewById(android.R.id.custom);
fl.addView(myView, new LayoutParams(MATCH_PARENT, WRAP_CONTENT));

The AlertDialog class takes care of automatically setting WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM for you based on whether any views in the dialog return true from View.onCheckIsTextEditor(). Generally you want this set for a Dialog without text editors, so that it will be placed on top of the current input method UI. You can modify this behavior by forcing the flag to your desired mode after calling onCreate(Bundle)

Reference

5697 questions
1
vote
1 answer

android get alert dialog default selected item

I have a little problem with setting the default selected item in Alert Dialog. Here is what I use in my code : if(memory>megAvailable){ selected = 0; } else if(megAvailable>memory){ selected = 1; } AlertDialog.Builder…
Android-Droid
  • 14,365
  • 41
  • 114
  • 185
1
vote
2 answers

Cancel an AlertDialog when screen is rotated

I have an AlertDialog.Builder displaying on an application. When I rotate the screen, I get "application has leaked window" error. How do I cancel the AlertDialog in the onPause() event? I don't see any method for Ad.cancel(). Update: code edited…
wufoo
  • 13,571
  • 12
  • 53
  • 78
1
vote
2 answers

Android alert Dialog not working

AlertDialog.Builder builder; AlertDialog alertDialog; Context mContext = getApplicationContext(); LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(LAYOUT_INFLATER_SERVICE); View layout =…
Gaurav
  • 667
  • 2
  • 13
  • 28
1
vote
1 answer

ImageButton Property Check

I have an ImageButton which on click i show a dialog box where users can either take a photo from the camera or choose from the gallery. On selecting image from either sources i setBitmap for that ImageButton to the image selected like…
Harsha M V
  • 54,075
  • 125
  • 354
  • 529
1
vote
3 answers

android- using nested alert dialogs

i m developing an app in which i m using facebook login when the user clicks on a button .. i show an alert dialog whether the user wants to add the page to favorites... and if yes... then another alert dialog whether he wants to proceed using…
Pratik Bhat
  • 7,166
  • 2
  • 35
  • 57
1
vote
3 answers

Can someone get this custom AlertDialog to actually work?

I asked another question about custom AlertDialog here. Then I clicked my way to this custom AlertDialog (found here): import android.app.AlertDialog; import android.content.Context; import android.webkit.WebView; /** * Display a simple about…
Ted
  • 19,727
  • 35
  • 96
  • 154
1
vote
1 answer

How to call methods that change UI from broadcast receivers correctly?

I have a broadcast receiver that detects the end of a outgoing call. After that, i want to show some dialog in my activity. I tried with this method in my activity: public static void buildShouldIFollowMessage(String callLength) { final…
DixieFlatline
  • 7,895
  • 24
  • 95
  • 147
1
vote
3 answers

How to start activity only after user clicks ok on AlertDialog

I have an AlertDialog and I only want the next Activity to start after I have click "OK". The problem is in my method, I have local variables attached to my intent and I cannot put in the onCreateDialog method. //local variable…
newbie
  • 958
  • 4
  • 13
  • 25
1
vote
1 answer

Android Service make popup in app or outside of app

This may be a compounded question as there are two concepts I don't yet understand that may be related. I want a Service to popup a custom alert dialog. I dont know a) if I can popup an alert dialog from a service (simply haven't tried yet, dont…
CQM
  • 42,592
  • 75
  • 224
  • 366
1
vote
1 answer

Android 14 outside of AlertDialog doesn't get dim

On Android 14 Upside-down cake emulator, when showing an alert dialog, outside of alert dialog doesn't get dim. How can I get dim just like other android versions? I tried: alertDialog.window?.setDimAmount(0.7f) But only Android 14 doesn't…
Tieria
  • 333
  • 3
  • 11
1
vote
0 answers

Android 14 dialog gray scrim disappears

I recently tried the Android 14 emulator (API Level 34) and verified how dialogs look like on the new OS. At first sight I noted that the dialog's scrim (used to be dark transparent gray) disappeared. See for instance here (on the left Android 14…
1
vote
1 answer

How to do Alert dialog in Android Kotlin return boolean value

I want to make static function with Alert dialog which return boolean value. In C# it looks like: DialogResult dialogResult = MessageBox.Show("Sure", "Some Title", MessageBoxButtons.YesNo); if(dialogResult == DialogResult.Yes) { //do…
marios160
  • 45
  • 5
1
vote
1 answer

How to keep a view above a bottomsheet/dialog

I'm basically trying to implement a custom notification/toast system in my app with a different behavior than a native toast (that's why I'm not using a custom native toast). The way I want to do it is that I want this view to show above of any view…
Buntupana
  • 984
  • 1
  • 15
  • 33
1
vote
2 answers

When I use Alert.Dialog the application crashes

I want to show prograssbar with the help of Alert.Dialog while saving data to database. but after registration the program crashes. A method that gives an error after running: private void saveData() { if (isPickPhoto) { …
gkhnmr
  • 13
  • 3
1
vote
1 answer

How to change the button size to full width in compose using Material 3 Alert Dialog

Hi I am creating a Alert dialog on some action, I need to get the Confirmation button to full width below is my code, Kindly look over it on achieving the full width of button and also , say if I get two button it must be aligned equally based on…