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

Remove external dark background on Material Dialog

I need to remove the grey background outside the dialog, exactly as shown here: How to remove transparent dark background outside of dialog box Sadly, I'm working with Material Dialog, and it seems I can't call dialog.getWindow().setDimAmount(float…
1
vote
1 answer

AlertDialog with too large text and width

I am using Android 2.3 I have an alertdialog in my app. Here the code: final CharSequence[] items = { "Entfernen", "Auswählen", "Editieren", "Zurücksetzen", "Abbrechen" }; AlertDialog.Builder builder = new…
tobias
  • 2,322
  • 3
  • 33
  • 53
1
vote
3 answers

Android: Does an AlertDialog.show() start a new thread?

Does an AlertDialog.show() start a new thread? I don't see any indication in the Android documentation that it does, and would like confirmation. Specifically, I want to make sure that the OnDismiss() callback occurs on the UI thread.
Jeff Axelrod
  • 27,676
  • 31
  • 147
  • 246
1
vote
2 answers

Android alert dialog with warning message

I have an alert dialog with an EditText in it and I'd like to warn the user when the entered input text is empty. So either : - by opening a new alert dialog on the top of the current one, but without closing the current one. I tried it and I don't…
thomaus
  • 6,170
  • 8
  • 45
  • 63
1
vote
2 answers

Android - Showing AlertDialog/Toast right after ProgressDialog finishes

I am quite new to Android programming, so please excuse me for the stupid question >,< Just like the title says, I want to show a AlertDialog/Toast right after my ProgressDialog finishes. How I can do this in the proper way? Note: My handler is only…
nic
  • 2,125
  • 1
  • 18
  • 33
1
vote
1 answer

Android: EditText setError covers up standard AlertDialog buttons

I have a standard (not custom, no layout) AlertDialog with literally just an EditText as its view and two buttons (OK and cancel.) When there's a problem with the input, I show an error message that ends up being three lines of text, which…
Jeff Axelrod
  • 27,676
  • 31
  • 147
  • 246
1
vote
0 answers

Android editable spinner plus virtual keyboard - is it possible?

I have AlertDialog with an editable Spinner which allows me to edit the selected value, but there is a problem. The edit control inside my Spinner accepts the focus after tap and if the device has a physical keyboard all is fine. But if no…
ggurov
  • 1,496
  • 2
  • 15
  • 21
1
vote
3 answers

How to detect that my AlertDialog is killed by system?

I have my dialog based on AlertDialog. When screen rotates (or some other config change happens), the dialog is closed by OS. Problem is that my dialog plays audio by MediaPlayer, and when such auto-close happens, dialog is gone but sound continues…
Pointer Null
  • 39,597
  • 13
  • 90
  • 111
1
vote
1 answer

Alert Android opens several times and does not close with dismiss

I have 2 alerts in sequence, where the last one does not close with dismiss, could you help me please? Below my code snippet. I have a custom view fun MaterialDialog.Builder.alertChangedIcon (action: () -> Unit) { this.apply { …
1
vote
1 answer

Problem in rotating a dialog which has an animation inside

I use the following class to create a rotatable dialog and everything is ok. import android.content.Context; import android.graphics.Canvas; import android.graphics.Matrix; import android.util.AttributeSet; import android.view.MotionEvent; import…
Bob
  • 22,810
  • 38
  • 143
  • 225
1
vote
2 answers

Android Kotlin AlertDialog.Builder() usage and context. "this" not working

This is my very first time using Kotlin/Android App Development, so I apologise if I am missing something simple. I have a background in Java and C#. I'm trying to display an AlertBox containing X information. All the tutorials I am reading/watching…
1
vote
2 answers

Compose Desktop AlertDialog rounded corners

In a compose desktop application I'm displaying an AlertDialog with rounded corners shape but there still appears a white rectangle at the corners. Here is my code: AlertDialog( modifier = Modifier .size(280.dp, 260.dp) …
Bruciew
  • 13
  • 5
1
vote
1 answer

Android KeyBoard doesn't show in AlertDialog

I have tried so many ways but I just can't get the display any Keyboard in my activity. Keyboard just doesn't show!!! I have button in my activity that when clicked calls the method below which creates a dialog with a listview inside and on top (in…
vallllll
  • 2,731
  • 6
  • 43
  • 77
1
vote
1 answer

Dismiss AlertDialog in onDestroy()?

Is it necessary to keep a reference to your spawned AlertDialog in your Activity and dismiss it in onDestroy() or could you just create it and forget it? It seems to be dismissed when your leave the Activity? I suppose the AlertDialog holds a…
JohnyTex
  • 3,323
  • 5
  • 29
  • 52
1
vote
3 answers

Android Dialog cannot 'see' final / global variable

I have an AlertDialog, which for some strange reason cannot access a final int deptID. When passing the value to the ConfirmRemoval-function, the value is correct, but when I enter the dialog's onClick event, the final int is undefined! I have even…
Rune Borgen
  • 369
  • 1
  • 4
  • 11