List of usage examples for android.content DialogInterface cancel
void cancel();
From source file:com.altcanvas.twitspeak.TwitSpeakActivity.java
private void promptTTSInstall() { AlertDialog ttsInstallDlg = new AlertDialog.Builder(this).create(); ttsInstallDlg.setMessage(getString(R.string.tts_install_msg)); ttsInstallDlg.setTitle(getString(R.string.tts_install_title)); ttsInstallDlg.setButton(DialogInterface.BUTTON_POSITIVE, getResources().getString(R.string.proceed_str), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.cancel(); Intent installIntent = new Intent(); installIntent.setAction(TextToSpeech.Engine.ACTION_INSTALL_TTS_DATA); startActivity(installIntent); }/* w ww . j a va 2s . c om*/ }); ttsInstallDlg.setButton(DialogInterface.BUTTON_NEGATIVE, getResources().getString(R.string.cancel_str), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.cancel(); finish(); } }); }
From source file:com.jaguarlandrover.auto.remote.vehicleentry.LockActivity.java
public void notififyGuestUsedKey(final String guestUser, final String guestService) { AlertDialog.Builder builder = new AlertDialog.Builder(LockActivity.this); builder.setInverseBackgroundForced(true); builder.setMessage("Remote key used by " + guestUser + "!").setCancelable(true).setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); }// www . j ava2s. c o m }); AlertDialog alert = builder.create(); alert.show(); }
From source file:com.jaguarlandrover.auto.remote.vehicleentry.LockActivity.java
private void handleExtra(Intent intent) { Bundle extras = intent.getExtras();// ww w.j a v a 2s .co m if (extras != null && extras.size() > 0) { for (String k : extras.keySet()) { Log.i(TAG, "k = " + k + " : " + extras.getString(k)); } } if (extras != null && "dialog".equals(extras.get("_extra1"))) { AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this); alertDialogBuilder.setTitle("" + extras.get("_extra2")); alertDialogBuilder.setMessage("" + extras.get("_extra3")).setCancelable(false).setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); alertDialogBuilder.create().show(); } }
From source file:com.giovanniterlingen.windesheim.view.Fragments.ChooseScheduleFragment.java
private void alertScheduleExists() { new AlertDialog.Builder(context).setTitle(getResources().getString(R.string.duplicate_title)) .setMessage(getResources().getString(R.string.duplicate_description)).setNegativeButton( getResources().getString(R.string.cancel), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); }/*from w ww .j ava2s . c o m*/ }) .show(); }
From source file:com.coincollection.ReorderCollections.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Check whether it is the users have seen this page SharedPreferences mainPreferences = getActivity().getSharedPreferences(MainApplication.PREFS, Activity.MODE_PRIVATE);//from w w w . j a v a2s.c o m if (mainPreferences.getBoolean("reorder_help1", true)) { // Show the user how to do everything // TODO Move to the strings resource page CharSequence text = "Drag a collection's coin image to reposition it in the list of collections. To scroll through the list, swipe using the right half of the screen. Tap 'Save' when finished."; AlertDialog.Builder builder = new AlertDialog.Builder(((MainActivity) getActivity()).getContext()); builder.setMessage(text).setCancelable(false).setPositiveButton("Okay!", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); SharedPreferences mainPreferences = getActivity() .getSharedPreferences(MainApplication.PREFS, Activity.MODE_PRIVATE); SharedPreferences.Editor editor = mainPreferences.edit(); editor.putBoolean("reorder_help1", false); editor.commit(); // .apply() in later APIs } }); AlertDialog alert = builder.create(); alert.show(); } return inflater.inflate(R.layout.activity_reorder_collections, container, false); }
From source file:com.rei.lolchat.ui.Login.java
/** * Create an about "BEEM" dialog.//w w w . j a v a 2s . c om */ private void createAboutDialog() { AlertDialog.Builder builder = new AlertDialog.Builder(this); String versionname; try { PackageManager pm = getPackageManager(); PackageInfo pi = pm.getPackageInfo("com.rei.lolchat", 0); versionname = pi.versionName; } catch (PackageManager.NameNotFoundException e) { versionname = ""; } String title = getString(R.string.login_about_title, versionname); builder.setTitle(title).setMessage(R.string.login_about_msg).setCancelable(false); builder.setNeutralButton(R.string.login_about_button, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { dialog.cancel(); } }); AlertDialog aboutDialog = builder.create(); aboutDialog.show(); }
From source file:com.eng.arab.translator.androidtranslator.ShowDetailsMonth.java
private void showAlert(String val) { AlertDialog.Builder alertDialog = new AlertDialog.Builder(getApplicationContext()); alertDialog.setTitle("Month Details").setMessage(val).setCancelable(false) //.setPositiveButton("OK", null) .setNegativeButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); }//from w w w .j a v a 2 s. com }).setCancelable(false); AlertDialog alert = alertDialog.create(); // Showing Alert Message alertDialog.show(); speakWords(val); }
From source file:com.ivan.autosms.MainActivity.java
public void openSendDialog(int nMessages, String licensePlate, String endTimeText) { String sendDialogMessage = "This will send %d SMS for license plate %s. Your ticket will be valid until %s."; String messageText = String.format(Locale.getDefault(), sendDialogMessage, nMessages, licensePlate, endTimeText);/*from ww w .j a v a 2 s . com*/ AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this); dialogBuilder.setMessage(messageText); dialogBuilder.setCancelable(true); dialogBuilder.setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { s.send(); } }); dialogBuilder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); AlertDialog sendDialog = dialogBuilder.create(); sendDialog.show(); }
From source file:co.carlosandresjimenez.android.gotit.FollowFragment.java
public void openResultDialog(String message) { AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(getActivity()); alertDialogBuilder.setIcon(android.R.drawable.ic_dialog_alert); alertDialogBuilder.setTitle("Request error"); // set dialog message alertDialogBuilder.setMessage(message).setCancelable(false) .setPositiveButton(R.string.action_edit, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { // if this button is clicked, close current activity dialog.cancel(); }/* w w w . jav a 2s.co m*/ }).setNegativeButton(R.string.action_cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { // if this button is clicked, just close the dialog box and do nothing dialog.cancel(); FollowFragment.this.getDialog().dismiss(); } }); // create alert dialog AlertDialog alertDialog = alertDialogBuilder.create(); alertDialog.setCanceledOnTouchOutside(false); // show it alertDialog.show(); }
From source file:edu.stanford.mobisocial.dungbeetle.obj.action.PlayAllAudioAction.java
public void onAct(Context context, DbEntryHandler objType, DbObj obj) { DBHelper helper = DBHelper.getGlobal(context); this.context = context; JSONObject objData = obj.getJson();//from w w w . j a v a 2 s .c om //TODO: this cursor really need to be closed somewhere!!! it may be but its sketchy //TODO: holy frickin hell its sketch... slutty code, plus it pulls the full body in as well //it should maybe load an objid list and then fetch each voice obj individually. String query = DbObject.FEED_NAME + "= ? AND " + DbObject.TYPE + "='voice' AND " + DbObject._ID + " >= (SELECT " + DbObject._ID + " FROM " + DbObject.TABLE + " WHERE " + DbObject.FEED_NAME + "= ? AND " + DbObject.TYPE + "='voice' AND " + DbObject.SEQUENCE_ID + "= ? AND " + DbObject.TIMESTAMP + "= ?)"; String[] queryParams = new String[] { objData.optString("feedName"), objData.optString("feedName"), objData.optString("sequenceId"), objData.optString("timestamp") }; c = helper.getReadableDatabase().query(DbObject.TABLE, null, query, queryParams, null, null, DbObject._ID + " ASC"); c.moveToFirst(); /*while(!c.isAfterLast()) { Log.w("PlayAllAudioAction", c.getString(c.getColumnIndex(DbObject.JSON))); c.moveToNext(); }*/ playNextSong(); //c.close(); Log.w("PlayAllAudioAction", c.getCount() + " rows"); AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setMessage("Now Playing Voice Messages").setCancelable(false).setNegativeButton("Stop Playing", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); c.moveToLast(); c.moveToNext(); mp.stop(); mp.release(); } }); alert = builder.create(); alert.show(); }