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
20
votes
5 answers

How to change the colour of Positive and negative button in Custom Alert dialog in android

What i am doing: I am creating a custom alert dialog What i am trying to do: along with below code, How to change the color of action buttons in dialog(positive and negative) @Override public Dialog onCreateDialog(Bundle savedInstanceState) { …
Devrath
  • 42,072
  • 54
  • 195
  • 297
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
4 answers

Refresh or change the AlertDialog Message

I create an AlertDialog AlertDialog.Builder builder = new AlertDialog.Builder(this); ... AlertDialog alert = builder.create(); alert.show(); After a moment I want to change the AlertDialog message without closing it. Is it possible?
Med Besbes
  • 2,001
  • 6
  • 25
  • 38
20
votes
7 answers

Android AlertDialog Move PositiveButton to the right and NegativeButton on the left

I'm new with android. Currently I want to show an AlertDialog box with 'OK' & 'Cancel' buttons. The default is PositiveButton: Left, NegativeButton: Right Can you let me know how can I move the PositiveButton to the right side & NegativeButton to…
user1866128
  • 281
  • 1
  • 3
  • 8
19
votes
5 answers

How to make a "do not ask me again" dialog pop-up box? Android

I am trying to create a "hint" dialog box that informs the user about enabling GPS on their phone will decrease battery life. I want it to pop-up but have a check box that says: "Do not ask me again". How do I go about creating this in…
Zukky
  • 237
  • 1
  • 2
  • 8
19
votes
3 answers

how to set an onclick listener for an imagebutton in an alertdialog

I have a layout with an ImageButton that is inflated in an AlertDialog, where/how should I set an onClick listener? Here's the code I tried using: ImageButton ib = (ImageButton) findViewById(R.id.searchbutton); ib.setOnClickListener(new…
Yvonne
  • 231
  • 1
  • 2
  • 6
19
votes
4 answers

Flutter how to set container background as transparent color

I found this question but doesn't work for me. I also play with Opacity widget and decoration color of Container. But didn't find solution It always display white background color when I set it transparent. Look at below image, Instead of red color…
iPatel
  • 46,010
  • 16
  • 115
  • 137
19
votes
7 answers

Remove Title from DatePickerDialog

For some reason, I have two titles in my DatePickerDialog. How can I get rid of the white title at the top? This is the code I use to create the Dialog: datePickerDialog = new DatePickerDialog(ProfileActivity.this, this, year, month,…
Alex
  • 402
  • 5
  • 13
19
votes
6 answers

How can I fix this error: You need to use a Theme.AppCompat theme (or descendant) with this activity

I searched all internet web sites to fix this error, but I couldn't. I just want to create AlertDialog with two button Yes and No. This is my code: import android.content.DialogInterface; import android.support.v7.app.AlertDialog; import…
Salar Rastari
  • 2,280
  • 5
  • 22
  • 35
19
votes
6 answers

android illegal exception when dialog is showing

I have crash log: java.lang.IllegalArgumentException: View=com.android.internal.policy.impl.PhoneWindow$DecorView{21f9ba68 V.E..... R.....ID 0,0-1136,402} not attached to window manager at…
Pein
  • 1,059
  • 3
  • 10
  • 31
19
votes
4 answers

Add RecyclerView(RecyclerFragment) to a Dialog

I have my custom RecyclerView to create a ListView. And it works great, when I am trying to populate a list view in my layout's id. FragmentTransaction ft = getFragmentManager().beginTransaction(); Bundle bundle = new…
19
votes
2 answers

Use the Android Default GPS ON-OFF dialog in My application

In Our application we want to integrate the android Default GPS Dialog. The same dialog that appears when the GPS is OFF and we press of my location button in google map apps. Have also attached the image of the dialog which I want to…
Balu
  • 1,069
  • 2
  • 10
  • 24
19
votes
4 answers

How to get the default alert Dialog on android have a black theme

How do you get the black themed Dialog in android like shown on the android guide http://developer.android.com/guide/topics/ui/dialogs.html I took a screen shot. Whenever I use Alert Dialog, I get the dialog on the left, I want the one on the…
Akshat Agarwal
  • 2,837
  • 5
  • 29
  • 49
19
votes
9 answers

How to create custom alert dialog in android?

I am developing a sample app.I am able to show alert on button click having some tittle and button .But now I want to show a pop up window having username (Label) and text field (Edit field) and a button. on click on button.can I make another…
user1542984
19
votes
2 answers

Communication between Fragment and DialogFragment

I'm trying to make a Fragment to show a Dialog using DialogFragment API. My dialog only has an EditText view and I want to pass the string wrote on it back to the Fragment. I'm able to show the dialog from the Fragment, but I'm not able to retrieve…
JoseLSegura
  • 3,830
  • 3
  • 20
  • 27