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

How to prevent dialog to cancel automatically

I have created a dialog. Now what I want is that onClick of the ok button of my dialog I don't want it to close. But here it is automatically closed. So how can I prevent the dialog to close automatically? The code I have written…
AndroidDev
  • 4,521
  • 24
  • 78
  • 126
1
vote
1 answer

How to put an onClick on a CardView in an AlertDialog

I'm trying to do a StartActivity of a CardView in an AlertDialog but it does not work I couldn't find anything similar on the internet, I also tried with a Button, I got the same error (see LogCat at the bottom of the post) Here is my layout of my…
busooCombo
  • 51
  • 4
1
vote
0 answers

Show dialog over another app without SYSTEM_ALERT_WINDOW permission

Right now, I'm using the following permission to show a dialog over another app : Dialog : dialogBuilder = new AlertDialog.Builder(activity); LayoutInflater inflater2 =…
1
vote
1 answer

Android Childactivity getParent question?

Basically I'm using ActivityGroup in my application. I have this situation: I have Tabhost with activity A. Activity A creates childActivity B. A ---> B startChildActivity("CollectionList", new Intent(this,MyCollectionList.class)); Activity B…
Android-Droid
  • 14,365
  • 41
  • 114
  • 185
1
vote
1 answer

AlertDialog with setView is too tall

I'm making an app and want to integrate donations since it's free and has no ads. I'm trying to add an AlertDialog with a QR code and a positive button. When I use this code, though, the AlertDialog is too tall (looks ugly), and you can't press the…
Marvil
  • 83
  • 1
  • 6
1
vote
1 answer

Exit the activity without closing the dialog

I'm preventing the dialog box from closing when I press the activity back button. When you press the back button, the dialog should exit without closing. Dialog.setCancelable(false); I tried this, but it makes the back button unstoppable when the…
1
vote
1 answer

Show composable snackbar/alert dialog from any context

I want to prompt the user with either a snackbar or an alert dialog based on the results of some Api calls. My app is a multi-activity one, and the API calls can return when the user is in any of those activities. I have a stateful composable so I…
1
vote
1 answer

MaterialAlertDialogBuilder crashes and shows error: The specified child already has a parent, when using custom view

when using custom layout with MaterialAlertDialog, it crashes and gives me this error: java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first. at…
1
vote
1 answer

How to disable positive button in onClick Function

I wanna disable positive button when one of input fields is empty. I tried to use ((AlertDialog)dialogInterface).getButton(AlertDialog.BUTTON_POSITIVE).setEnabled(false); But it does not work. new AlertDialog.Builder(MainActivity.this) …
1
vote
3 answers

Flutter Alertdialog overflow cutoff

I have a working Alertdialog but I get an overflow error and I can't get rid of it. I have tried flexible and expanded but maybe on the wrong levels. builder: (BuildContext context) => AlertDialog( title: const…
JBoudry
  • 77
  • 1
  • 7
1
vote
2 answers

Android: alertDialog not working

I am trying to add an alert dialogue on click of button, but some how it is not working.. but the toast i added is working perfectly. Could somebody please help me out. I've added context directly instead of "this" when creating object [ new…
Codemator
  • 513
  • 1
  • 10
  • 19
1
vote
2 answers

Create AlertDialog in Android

I'm trying to create an Aler Dialog but when I click on button my application crash.Any idea what's happening and how can I fix that? Here is the code : Button deactivate = (Button) findViewById(R.id.deactivate); …
hardartcore
  • 16,886
  • 12
  • 75
  • 101
1
vote
0 answers

How to properly blur the background while showing a dialog

Hello there I'm using a dialog and I want to blur the background but there is an issue I'm trying to achieve blur similar to this I find a question that has the same issue but unsolved Alert dialog blur only part of the screen ok I have used this…
Vasant Raval
  • 257
  • 1
  • 12
  • 31
1
vote
0 answers

JNI calling Android dialog, waiting for user choice

I have a scenario when my JNI is calling a Java method in order to display a dialog with two options, and the option should be passed back to the JNI method. I think it should be some sort of a callback, but I have not idea how to approach it with…
1
vote
3 answers

Android AlertDialog constructor is undefined

I'm trying to have a alert dialog show if account info is missing when clicking the check the account. I get an error in Eclipse where new AlertDialog.Builder(this) saying the constructor AlertDialog.Builder(new View OnClickListener(){}) is…
Kim Jensen
  • 11
  • 1
  • 1
  • 2