android-alertdialog

Android Alert Dialog - how to hide the OK button after it being pressed

六眼飞鱼酱① 提交于 2019-12-20 10:57:53
问题 I have been developing an Android app. I would like to hide the OK button after the user presses it, as the dialog window will stay at the foreground for some seconds while a computation takes place. This is the code: new AlertDialog.Builder(this) .setMessage("This may take a while") .setPositiveButton("OK", new android.content.DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // hide the OK button - how? // a lot of computation } }) .show(

How to prompt to user an alert dialog but not when my app is forground?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-20 06:29:57
问题 i want to show the user an alert dialog message, that he can choose yes/no but i want to do that automatical even and mainly when my app is not forground, like clock alarm, that can jump up to screen in any situation (even if user in call).. how to do that? i succeed to do alert.. but its came up just when my app is forground :/ using this guide: http://www.androidhive.info/2011/09/how-to-show-alert-dialog-in-android/ please help me, thank's. 回答1: You can't, AFAIK, a Dialog needs an Activity

how to toast a message if editText is empty by clicking button?

我的梦境 提交于 2019-12-20 04:51:27
问题 i have 2 edit Text in my application, 1 button to add the input numbers in the edit Text and 1 text view to display the result. I would like to put a toast message if my edit text tab is empty or null when i click the button. I have searched and tried all the solutions..and nothing seems to work. help please!! here is my code for adding the two numbers. MainActivity.java package com.example.mycalc; import android.app.Activity; import android.os.Bundle; import android.view.Menu; import android

Changing AlertDialog buttons alignment

邮差的信 提交于 2019-12-20 04:36:08
问题 Been fighting for hours about changing the alignment of the buttons inside AlertDialog (support.v7 one), since they won't align themselves according to the locale view direction, despite the whole app DOES align to left and also the text inside the AlertDialog. (Why would this happen you say? I'm programatically configuring the locale language to be "en" since that's my default app language, even though the system locale might be something else). So like I said, I don't need to touch the

Permanently adding an item to an existing alertdialog?

扶醉桌前 提交于 2019-12-20 04:13:09
问题 My goal is to permanently add an item to an existing AlertDialog. The XML array for the AlertDialog is: <array name="serverchoice"> <item>@string/chicago_server</item> <item>@string/london_server</item> <item>@string/sanjose_server</item> <item>@string/washington_server</item> <item>@string/chicagoq_server</item> <item>@string/londonq_server</item> <item>@string/sanjoseq_server</item> <item>@string/washingtonq_server</item> </array> As you can see it's a list of servers, I'd like a user to be

How to make BaseAdapter show AlertDialog android Application

主宰稳场 提交于 2019-12-20 03:24:09
问题 How can I make the button in BaseAdapter in listView shows alertDialog, I tried that but it Stopped work unexpected (RunTime Error) my code is shown below . any suggestion thanks in advance Monerah ====after Update ===================== import java.util.List; import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter;

error: requestFeature() must be called before adding content - Still won't work

喜夏-厌秋 提交于 2019-12-20 02:50:06
问题 I know that similar questions have been asked in the past but I can't seem to get this working at all even with the suggestions. I get the above abend on the "show()" command. public void onCreate(Bundle savedInstanceState) { try{ super.onCreate(savedInstanceState); setContentView(R.layout.submitscoredummylayout); scoreloopInit(); AlertDialog whatToUploadDialog; whatToUploadDialog = new AlertDialog.Builder(YanivSubmitScoreActivity.this).create(); whatToUploadDialog.setContentView(R.layout

Custom alert dialog android

南楼画角 提交于 2019-12-19 11:57:48
问题 I am working with custom alert dialog in android. I have followed the link 1 and linke 2. In my code using these styles. <style name="DialogAnimation"> <item name="android:windowEnterAnimation">@anim/slide_up_dialog</item> <item name="android:windowExitAnimation">@anim/slide_out_down</item> <!-- Animation for dialog box --> <style name="DialogSlideAnim" parent="AppBaseTheme"> <item name="android:windowAnimationStyle">@style/DialogAnimation</item> </style> From these styles I am getting

Android : Change CheckBox checked value in ListView when getFilter() called

末鹿安然 提交于 2019-12-19 10:26:28
问题 I recently posted my Question for MultiSpinner values to choose Multiple values from Spinner dialog. I've done successfully with following class. MultiSpinnerSearch.java package com.example.multiplechoicelistwithfilter; import java.util.List; import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; import android.content.DialogInterface.OnCancelListener; import android.text.Editable; import android.text.TextWatcher; import android.util

Change text color of alert dialog

删除回忆录丶 提交于 2019-12-19 05:01:30
问题 I have a popup for downloading the audio instruction in my app. What I am trying to do is I want to change the default text color of "OK" to blue. I tried something but its not working. Here is my code: private void showDownloadPgmPopup() { android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(getActivity()); builder.setTitle("Download instructional audio?"); builder.setMessage(ParamConstants.AUDIODOWNLOADPERMISSION); builder.setNegativeButton("No", new DialogInterface