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 development: How to listen to clipboard changes outside of an APP on Android 11?

I have a personal APP primarily developed for Android 9 that listens to clipboard changes and prompt a window on top of wherever I copy a URL. The implementation is as below: ClipboardManager.OnPrimaryClipChangedListener listener = () -> { …
1
vote
1 answer

Popup window in fragment in kotlin

I need popup window to show my user's options for example, I was wondering to add a long press botton and then when that button clicked, show a popup window with transparent background and when outside clicked close popup window exactly like this I…
1
vote
2 answers

Alertdialog running ongoing dosen't dismiss or cancel

According this answer , I wanna to show dilaog until the next 10 posts is loaded so I created the static alertDialog method to use it in different places in my app, but the problem is the dialog doesn't cancel or dismiss setProgressDialog in Utils…
1
vote
1 answer

Android custom dialog not displaying title and message

I have a custom dialog and both the title and the message are not being displayed: import android.app.Dialog import android.os.Bundle import android.view.View import android.widget.TextView import androidx.appcompat.app.AlertDialog import…
1
vote
1 answer

Showing dialog in MVVM Android throws exception only when certain variable changes in the ViewModel

I have a MainActivity using a DrawerLayout and tabs with 2 fragments. My first fragment contains a list of elements in a RecyclerView, and I can click on each element to "select" it (which calls a SDK function to login to a hardware device). When…
1
vote
2 answers

Alert Dialog doesn't show radio buttons

I have an alertDialog with the following code : AlertDialog.Builder b = new AlertDialog.Builder(Activity.this); String[] types = getResources().getStringArray(R.array.text_spinner_NewClass_dayList); b.setSingleChoiceItems(types, 2, (dialog, which)…
1
vote
1 answer

Getting "Can't find ColorStateList from drawable resource ID" when adding AlertDialog in Jetpack Compose

I'm getting this Can't find ColorStateList from drawable resource ID #0x108028b error when adding AlertDialog in my app. I also tried following this answer, but it didn't help. if android:statusBarColor is the issue then this is the code I'm using…
1
vote
1 answer

How to show AlertDialog even if Activity is on background?

I have an AlertDialog and I want to show it even if the user is visiting another activity. This is AlertDialog: AlertDialog.Builder builder = new AlertDialog.Builder(context.getApplicationContext()); …
Besart
  • 309
  • 1
  • 4
  • 22
1
vote
0 answers

Why is the alertDialog wider than display?

I try to create an alert dialog with the customed layout. I set the width with ViewGroup.LayoutParams.MATCH_PARENT, but the alert dialog is wider than the screen. Could you please give me some suggestions? Here are my codes and the XML file. val…
Anna ZOU
  • 11
  • 4
1
vote
1 answer

Changing layout element attributes in Custom AlertDialog Class

So I am building a really basic app. I'm using an alert dialog to show the user whether they've won or not. What I have done is that I created this class : public class WinLoseDialog { Activity activity; AlertDialog dialog; TextView text; …
Arnav Mangla
  • 82
  • 1
  • 7
1
vote
1 answer

How to observe live data for Alert Dialog

I have Alert Dialog opened from fragment, It have two edittext and one button, one edittext will be visible at a time. On clicking submit, call API -> based on response -> second edittext will be visible. Im using ViewModel and LiveData for…
1
vote
1 answer

How to show Alert Dialog box in Service android

Iam new to android,I want to show alert dialog box in service,I used two methods as shown below First one without Layout AlertDialog.Builder builder = new AlertDialog.Builder(MyService.this); builder.setTitle("Test…
Durai DD
  • 189
  • 1
  • 10
1
vote
1 answer

Set text Length of alert dialog in Android studio

How do I set the max of how many characters can be entered. So now the user can enter a lot in the alertdialog While it should have the max. it's not like XML. That would have been easier, any tips for this alert dialog? private void…
user15908935
1
vote
1 answer

What is the font used in following Android Material dialog?

I want to know what is this font used for CANCEL, DECLINE and ACCEPT in the following material dialog.
1
vote
1 answer

How to show an alert dialog after the user click the button in flutter

I'm new in flutter and I'm trying to show a dialog alert for the result if the user click on "Calculate" button. I want to change the "Text" result into the dialog alert like "The prediction of (total days) is (result)" Anyone can help me how to do…
New user
  • 147
  • 4
  • 18