android-alertdialog

Modal dialog functionality using AlertDialog

試著忘記壹切 提交于 2019-12-31 04:54:06
问题 I want to keep AlertDialog focused until a user presses any of the buttons on it. In other words, even if a user presses any other area (like it's parent area) or presses back button, dialog must still remain focused. Please let me know which Android 4.0 API method to use. Thanks much in advance. 回答1: use setCancelable(false); It will stop removing your AlertDialog from your screen. 来源: https://stackoverflow.com/questions/8920661/modal-dialog-functionality-using-alertdialog

How do I display no internet connection popup and an html page when internet is not available for webview?

二次信任 提交于 2019-12-31 03:50:30
问题 I am using webviews in my app and want to make sure when internet is not available the pop up message displays for no internet connection and also displays an html page in the background saying internet connection required. I have added some code for checking internet connection, but its not working/ showing errors for checkmark(code added based on online research). Any clue how to fix the same? Here's the code below: public void onCreate(Bundle savedInstanceState){ super.onCreate

Display a confirmation dialog before sending SMS

烈酒焚心 提交于 2019-12-31 02:55:35
问题 I am new to Android and I have bound my application completely but I wish to a change now in it. When someone sends an sms, I want to display a confirmation dialog for sending sms asking for send or not. And I have to make a common class for that I have written the source code and it works fine but if user does not click on Yes or Cancel the dialog goes out but I wish that it will still display until user does not click on Yes or Cancel button. How it can be solved? public void send_SMS(

Display a confirmation dialog before sending SMS

冷暖自知 提交于 2019-12-31 02:55:07
问题 I am new to Android and I have bound my application completely but I wish to a change now in it. When someone sends an sms, I want to display a confirmation dialog for sending sms asking for send or not. And I have to make a common class for that I have written the source code and it works fine but if user does not click on Yes or Cancel the dialog goes out but I wish that it will still display until user does not click on Yes or Cancel button. How it can be solved? public void send_SMS(

Android AlertDialog box WindowManager$BadTokenException problem

拜拜、爱过 提交于 2019-12-30 08:13:51
问题 I am using the the following code for a context menu and then if user chose delete, a dialog massage will appear. infos.setOnCreateContextMenuListener(new OnCreateContextMenuListener(){ //@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { menu.setHeaderTitle("Context Menu"); menu.add(0, CONTEXT_EDIT, 0, "Edit Item"); menu.add(0, CONTEXT_DELETE, 1, "Delete Item"); } }); public boolean onContextItemSelected(MenuItem item) { AdapterView

ActionBarSherlock doesn't support light-theme alert dialogs?

主宰稳场 提交于 2019-12-30 06:59:07
问题 Well as the title says, i'm using the actionBarSherlock library and a light theme, and sometimes I need to show a dialog using the alertDialog.Builder class. Thing is, no matter what I try, the theme doesn't apply to the dialog itself. The theme should work on both new APIs and old ones (prior to honeycomb). example: code: final AlertDialog.Builder builder = new AlertDialog.Builder(new ContextThemeWrapper(activity, R.style.AppTheme_LightDialog)); or: final AlertDialog.Builder builder = new

Show alertDialog with radiobuttons when click a listViewItem

你说的曾经没有我的故事 提交于 2019-12-30 06:25:10
问题 I have a listView with 2 items in it, the 2 items are "seconds" and "minutes" When I press "seconds" I'd like a alertDialogBox to open en show 5,10,15,... seconds. Same when I press minutes Something like this: But I'm having trouble implementing it, because I don't understand very well how it is working. Here is the code I have: import android.app.Activity; import android.app.AlertDialog; import android.content.DialogInterface; import android.os.Bundle; import android.view.View; import

align AlertDialog buttons to center

有些话、适合烂在心里 提交于 2019-12-28 16:31:08
问题 I use this codes for Android (Java) programming: public static MessageBoxResult showOk( Context context, String title, String message, String okMessage) { okDialogResult = MessageBoxResult.Closed; // make a handler that throws a runtime exception when a message is received final Handler handler = new Handler() { @Override public void handleMessage(Message mesg) { throw new RuntimeException(); } }; AlertDialog.Builder alert = new AlertDialog.Builder(context); alert.setTitle(title); alert

How to dismiss AlertDialog in android

青春壹個敷衍的年華 提交于 2019-12-27 23:37:00
问题 I created AlertDialog that contains 4 buttons OptionDialog = new AlertDialog.Builder(this); OptionDialog.setTitle("Options"); LayoutInflater li = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View v = li.inflate(R.layout.options, null, false); background = (Button) v.findViewById(R.id.bkgSpinnerLabel); SoundVib = (Button) v.findViewById(R.id.SoundVibSpinnerLabel); OptionDialog.setView(v); OptionDialog.setCancelable(true); OptionDialog.setNeutralButton("Ok", new

How to dismiss AlertDialog in android

感情迁移 提交于 2019-12-27 23:36:38
问题 I created AlertDialog that contains 4 buttons OptionDialog = new AlertDialog.Builder(this); OptionDialog.setTitle("Options"); LayoutInflater li = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View v = li.inflate(R.layout.options, null, false); background = (Button) v.findViewById(R.id.bkgSpinnerLabel); SoundVib = (Button) v.findViewById(R.id.SoundVibSpinnerLabel); OptionDialog.setView(v); OptionDialog.setCancelable(true); OptionDialog.setNeutralButton("Ok", new