android-alertdialog

Refresh or change the AlertDialog Message

China☆狼群 提交于 2020-07-03 05:50:09
问题 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? 回答1: Yes ,you can. For example, if you create your own dialog, with your own layout, you can set an id for each of the views, and then access each of them (for example the textView) and set its new text whenever you wish to. 回答2: Agreed with android developer. You

Style applied to an AlertDialog not working correctly

夙愿已清 提交于 2020-06-23 03:44:33
问题 I've been asked to match the look of an Alert Dialog in our app to the one used by the app's theme. I managed to apply a style to all Alert Dialogs in the app using it as part of the app's theme, but there are situations where the style is not applying correctly. It happens for example when the Alert Dialog contains a 'Single Choice List' as its' message. The title looks fine, so is the background and the button bar, but the list itself is problematic. At first, the radio buttons as well as

Style applied to an AlertDialog not working correctly

橙三吉。 提交于 2020-06-23 03:41:14
问题 I've been asked to match the look of an Alert Dialog in our app to the one used by the app's theme. I managed to apply a style to all Alert Dialogs in the app using it as part of the app's theme, but there are situations where the style is not applying correctly. It happens for example when the Alert Dialog contains a 'Single Choice List' as its' message. The title looks fine, so is the background and the button bar, but the list itself is problematic. At first, the radio buttons as well as

Not working onbackpressed when setcancelable of alertdialog is false

风格不统一 提交于 2020-05-20 07:35:07
问题 I have an AlertDialog and its setCancelable() is false. In Onbackpressed function I want the AlertDialog to be closed. But when setCancelable() is false, the back key doesn't work at all. What should I do to get rid of this problem? I don't want to change setCancelable() to true because I will have another problem. import android.os.Bundle import android.widget.Toast import androidx.appcompat.app.AlertDialog import androidx.appcompat.app.AppCompatActivity class MainActivity :

Android Kotlin findViewById must not be null

十年热恋 提交于 2020-05-15 00:45:32
问题 We have created a custom alert dialog that was used in a Java project by converting it to Kotlin The error posted below java.lang.IllegalStateException: findViewById(R.id.btnYES) must not be null The error source is eluding us ! We have looked at a number of posts and tried a few with no results. The Activity structure is as follows PageTwoActivity has its own XML file with two buttons attached. The custom dialog has its own xml file Here is the PageTwoActivity code. Without the two buttons

How to make an Alertdialog with Multichoice items along with an EditText?

自作多情 提交于 2020-05-13 22:39:38
问题 I have a AlertDialog of Multichoice Items.I want to have an EditText beside each item. How do i achieve this? third_card.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { final AlertDialog.Builder mBuilder = new AlertDialog.Builder(EnterRecordActivity.this); mBuilder.setTitle("Select Contributor"); mBuilder.setMultiChoiceItems(listMembers, checkedMembers, new DialogInterface.OnMultiChoiceClickListener() { @Override public void onClick(DialogInterface

Why is there no gap between my two AlertDialog buttons?

自闭症网瘾萝莉.ら 提交于 2020-05-10 14:09:31
问题 In my AlertDialog, my Positive Button and Negative Button are "attached." I'm pretty sure there should be a gap between them. Can someone tell me why this is happening? I would be happy to provide any code. Here is what my AlertDialog looks like. I have a custom View for the Body as well as the Title of my AlertDialog (I won't post that XML code because I don't think it's necessary, but let me know.) In MainActivity, I inflate my custom title and body Views, and override setPositive() and

Why is there no gap between my two AlertDialog buttons?

微笑、不失礼 提交于 2020-05-10 14:07:05
问题 In my AlertDialog, my Positive Button and Negative Button are "attached." I'm pretty sure there should be a gap between them. Can someone tell me why this is happening? I would be happy to provide any code. Here is what my AlertDialog looks like. I have a custom View for the Body as well as the Title of my AlertDialog (I won't post that XML code because I don't think it's necessary, but let me know.) In MainActivity, I inflate my custom title and body Views, and override setPositive() and

Why is there no gap between my two AlertDialog buttons?

那年仲夏 提交于 2020-05-10 14:05:29
问题 In my AlertDialog, my Positive Button and Negative Button are "attached." I'm pretty sure there should be a gap between them. Can someone tell me why this is happening? I would be happy to provide any code. Here is what my AlertDialog looks like. I have a custom View for the Body as well as the Title of my AlertDialog (I won't post that XML code because I don't think it's necessary, but let me know.) In MainActivity, I inflate my custom title and body Views, and override setPositive() and

AlertDialog disappears when touch is outside [Android] [duplicate]

此生再无相见时 提交于 2020-05-08 18:57:25
问题 This question already has answers here : Prevent Android activity dialog from closing on outside touch (19 answers) android 4.0 Dialog gets canceled when touched outside of dialog window (3 answers) Closed 3 years ago . I'm using an Alert Dialog on my application, but it keeps hiding when the users touches outside it. Here is my code: public class DialogMessageEnd extends DialogFragment { String winner; @Override public Dialog onCreateDialog(Bundle savedInstanceState) { // Use the Builder