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 show Alert on top of all Activities in android?

I am doing an AsyncTask to call an API call in my application. And showing the API response as an Alert. I have written that API calls on home screen activity and showed that alert on top of the home screen. But if I moved from that activity to…
1
vote
1 answer

How to forbid user to close alert dialog touching outside it?

I have this dialog fragment class: class AskDownloadFragment : DialogFragment() { private lateinit var navController: NavController private lateinit var mainActivity: MainActivity override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { …
1
vote
1 answer

Why does my negative button appear on the left side of my alert dialog?

AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle("Do you want to continue?"); builder.setMessage("Press Yes or No"); builder.setCancelable(false); builder.setPositiveButton("Yes", new…
Koroski
  • 11
  • 2
1
vote
1 answer

Android AlertDialog like the Permissions Dialog in Android 10 and above

I have been searching for example when I can customize my AlertDialog in the same way the permissions are asked on Android 10 and above, with all the options in between and center aligned. Any help will be appreciated.
1
vote
1 answer

Use Java AlertDialog in react-native

I am working on a react-native application that uses the NearbyConnection API. I don't want the connection to be automatically accepted. The user should be able to accept or decline the connection. I tried the code proposed by Google (code…
parice02
  • 13
  • 5
1
vote
2 answers

How do I continuously show an AlertDialog in a do while loop until a certain condition is met?

I have an AlertDialog that I want to display at least once to the user and then continuously display the dialog to the user even after the user clicks "ok" until a certain condition is met. Here's the code structure I have so far for the…
Tom Darious
  • 434
  • 6
  • 18
1
vote
2 answers

NullPointerException in custom DialogBox on android

In my app i have custom dialog which is displayed by a button click in first activity. In the custom dialog box i have number wheels to select numbers. The UI is displayed correctly but when i implement coding i am getting null pointer…
M.A.Murali
  • 9,988
  • 36
  • 105
  • 182
1
vote
2 answers

how to add items name in alert dialog from strings.xml in android

in my app when i click a button i am opening an Alert Dialog builder. My code is as follows AlertDialog.Builder builder = new AlertDialog.Builder(BannerImage.this); final CharSequence[] items = {"Skip", "video", "Audio", "Games"}; builder.setTitle("…
Siva K
  • 4,968
  • 14
  • 82
  • 161
1
vote
2 answers

Problem in Creating dialog box in click event of another dialog box

I like to display one dialog box in the click event of another dialog box.My code is given below.But it shows an error- Syntax error on token ")", ; expected,Syntax error on token ")", ; expected.Can anybody clear this problem final CharSequence[]…
bejoy george
  • 29,385
  • 5
  • 19
  • 15
1
vote
0 answers

Custom Dialog Didnt Show Icon Outside Layout

I have make a custom dialog but it doesn't work as what i expect, been looking through other answer in stack overflow here is my method val mDialogView = LayoutInflater.from(mFragment.requireContext()).inflate( …
1
vote
1 answer

Error: java.lang.UnsupportedOperationException: Failed to resolve attribute at index 6: TypedValue{t=0x2/d=0x101009b a=1}

I am trying to show an AlertDialog but sometimes it crashes and it shows this error message in crashlytics Caused by java.lang.UnsupportedOperationException: Failed to resolve attribute at index 6: TypedValue{t=0x2/d=0x101009b a=1} at…
SwiftiSwift
  • 7,528
  • 9
  • 56
  • 96
1
vote
0 answers

How to scale materialalertdialog with screen size?

Currently, I am trying to create a materialalertdialog that should scale with the screen size. For example, the text size and the buttons should get bigger on tablets than they are on normal phone screens. But whatever I do, I don't seem to achieve…
Andrew
  • 4,264
  • 1
  • 21
  • 65
1
vote
1 answer

How to define the screen hue/color after AlertDialog shown?

When AlertDialog is being shown, the whole screen hue/color changes. Is it somehow possible to define to which color should it be changed? Below are screens - before and after AlertDialog appears. Before: After: You can see that the screen color…
Sebeg13
  • 281
  • 3
  • 6
1
vote
2 answers

How to set my android webview to remember new passwords?

I'm loading a webpage (for example mail.yahoo.com) in a webview. After entering username and password an AlertDialog shows asking me if I wanna remember the password which I do. The thing is that after logging out, if another user wants to login,…
philtz
  • 227
  • 6
  • 14
1
vote
2 answers

How to customise the alertdialog in Android?

I have an AlertDialog in my application, for which I want to have a background for the whole dialog, and a background and text color for the 2 buttons. I cannot seem to customise the alertDialog. How can I do it? I want the dialog to look like the…
Ian Bell
  • 533
  • 5
  • 18
1 2 3
99
100