List of usage examples for android.app AlertDialog.Builder show
public void show()
From source file:org.anhonesteffort.flock.SubscriptionGoogleFragment.java
private void handlePromptCancelSubscription() { AlertDialog.Builder builder = new AlertDialog.Builder(subscriptionActivity); builder.setTitle(R.string.cancel_subscription); builder.setMessage(R.string.are_you_sure_you_want_to_cancel_your_flock_subscription); builder.setNegativeButton(R.string.no, null); builder.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() { @Override/*from www . j a va 2 s .com*/ public void onClick(DialogInterface dialog, int id) { handleCancelSubscription(); } }); alertDialog = builder.show(); }
From source file:de.gadc.moneybeam.MoneyBeamActivity.java
/** * This method presents the user the dialog that enables him to enter his * email address./*from w w w. j a v a 2 s.c om*/ */ private void showEmailDialog() { final EditText editText = new EditText(this); AlertDialog.Builder emailDialogBuilder = new Builder(this); emailDialogBuilder.setTitle(R.string.hint_email); editText.setImeOptions(EditorInfo.IME_ACTION_DONE); editText.setInputType(InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS); emailDialogBuilder.setView(editText); emailDialogBuilder.setPositiveButton(R.string.button_ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { String mail = editText.getText().toString(); prefs.edit().putString(Configuration.PREF_MAIL, mail).commit(); } }); emailDialogBuilder.setNegativeButton(R.string.button_cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); emailDialogBuilder.show(); }
From source file:net.evecom.androidecssp.base.BaseActivity.java
/** * /*www . j a v a2 s . c o m*/ * * @param errorMsg */ protected void dialogToastNoCall(String errorMsg) { AlertDialog.Builder builder1 = new AlertDialog.Builder(this); builder1.setTitle(""); builder1.setIcon(R.drawable.qq_dialog_default_icon);// builder1.setMessage("" + errorMsg); builder1.setPositiveButton("", new DialogInterface.OnClickListener() { // @Override public void onClick(DialogInterface dialog, int which) { } }); builder1.show(); }
From source file:study.tdcc.act.MainCalendar.java
/** * About?/*from ww w . j a va 2s . c o m*/ * * @param context * @param title * @param text */ //About? private static void showDialog(Context context, String title, String text) { Log.d("DEBUG", "MainCalendar showDialog Start"); AlertDialog.Builder ad = new AlertDialog.Builder(context); ad.setTitle(title); ad.setMessage(text); ad.show(); Log.d("DEBUG", "MainCalendar showDialog End"); }
From source file:com.capstonecontrol.AccountsActivity.java
/** * Sets up the 'connect' screen content. *//*from w ww .j av a2s . c om*/ private void setConnectScreenContent() { List<String> accounts = getGoogleAccounts(); if (accounts.size() == 0) { // Show a dialog and invoke the "Add Account" activity if requested AlertDialog.Builder builder = new AlertDialog.Builder(mContext); builder.setMessage(R.string.needs_account); builder.setPositiveButton(R.string.add_account, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { startActivity(new Intent(Settings.ACTION_ADD_ACCOUNT)); } }); builder.setNegativeButton(R.string.skip, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { finish(); } }); builder.setIcon(android.R.drawable.stat_sys_warning); builder.setTitle(R.string.attention); builder.show(); } else { final ListView listView = (ListView) findViewById(R.id.select_account); listView.setAdapter(new ArrayAdapter<String>(mContext, R.layout.account, accounts)); listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE); listView.setItemChecked(mAccountSelectedPosition, true); final Button connectButton = (Button) findViewById(R.id.connect); connectButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { CapstoneControlActivity.userChanged = true; // Set "connecting" status SharedPreferences prefs = Util.getSharedPreferences(mContext); prefs.edit().putString(Util.CONNECTION_STATUS, Util.CONNECTING).commit(); // Get account name mAccountSelectedPosition = listView.getCheckedItemPosition(); TextView account = (TextView) listView.getChildAt(mAccountSelectedPosition); // Register register((String) account.getText()); // finish(); // clear the module list so that a new one will get found CapstoneControlActivity.modules.clear(); // instead of finish() go back to the AccountsActivity for // new login. CapstoneControlActivity.googleUserName = (String) account.getText(); Intent myIntent = new Intent(v.getContext(), SplashActivity.class); startActivity(myIntent); myIntent = new Intent(v.getContext(), CapstoneControlActivity.class); startActivity(myIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)); } }); } }
From source file:com.listomate.activities.AccountsActivity.java
/** * Sets up the 'connect' screen content. *//*from w ww .j a va2 s. co m*/ private void setConnectScreenContent() { List<String> accounts = getGoogleAccounts(); if (accounts.size() == 0) { // Show a dialog and invoke the "Add Account" activity if requested AlertDialog.Builder builder = new AlertDialog.Builder(mContext); builder.setMessage(R.string.needs_account); builder.setPositiveButton(R.string.add_account, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { startActivity(new Intent(Settings.ACTION_ADD_ACCOUNT)); } }); builder.setNegativeButton(R.string.skip, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { finish(); } }); builder.setIcon(android.R.drawable.stat_sys_warning); builder.setTitle(R.string.attention); builder.show(); } else { final ListView listView = (ListView) findViewById(R.id.select_account); listView.setAdapter(new ArrayAdapter<String>(mContext, R.layout.account, accounts)); listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE); listView.setItemChecked(mAccountSelectedPosition, true); final Button connectButton = (Button) findViewById(R.id.connect); connectButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { // Register in the background and terminate the activity mAccountSelectedPosition = listView.getCheckedItemPosition(); TextView account = (TextView) listView.getChildAt(mAccountSelectedPosition); register((String) account.getText()); finish(); } }); final Button exitButton = (Button) findViewById(R.id.exit); exitButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { finish(); } }); } }
From source file:gr.scify.newsum.ui.SearchViewActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if ((getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) != Configuration.SCREENLAYOUT_SIZE_NORMAL & (getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) != Configuration.SCREENLAYOUT_SIZE_SMALL) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); }//from w w w.jav a 2 s .c om SharedPreferences usertheme = getSharedPreferences("theme", 0); int newTheme = usertheme.getInt("theme", 2); Utils.onActivityCreateSetTheme(this, newTheme); SharedPreferences userlang = getSharedPreferences("lang", 0); String newlang = userlang.getString("lang", Locale.getDefault().getLanguage()); Setlanguage.updateLanguage(getApplicationContext(), newlang); GestureOverlayView gestureOverlayView = new GestureOverlayView(this); View inflate = getLayoutInflater().inflate(R.layout.view, null); gestureOverlayView.addView(inflate); gestureOverlayView.addOnGesturePerformedListener(this); gestureOverlayView.setGestureColor(Color.TRANSPARENT); gestureOverlayView.setUncertainGestureColor(Color.TRANSPARENT); gestureLib = GestureLibraries.fromRawResource(this, R.raw.gestures); if (!gestureLib.load()) { finish(); } requestWindowFeature(Window.FEATURE_CUSTOM_TITLE); setContentView(gestureOverlayView); getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.custom_title); ImageView title_image = (ImageView) findViewById(R.id.title_image); title_image.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent browse = new Intent(Intent.ACTION_VIEW, Uri.parse(getResources().getString(R.string.scify))); startActivity(browse); } }); // setContentView(R.layout.view); // TODO: Add Loading dialog SharedPreferences setvmassage = getSharedPreferences("dialog", 0); boolean dialogShown = setvmassage.getBoolean("dialogShown", false); if (!dialogShown) { // prepare the alert box AlertDialog.Builder alertbox = new AlertDialog.Builder(this); alertbox.setMessage(R.string.view_massage); alertbox.setNeutralButton(R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface arg0, int arg1) { } }); alertbox.setCancelable(false); alertbox.show(); SharedPreferences.Editor editor = setvmassage.edit(); editor.putBoolean("dialogShown", true); editor.commit(); } // Init waiting dialog showWaitingDialog(); initLayoutAndControls(); }
From source file:com.poinsart.votar.VotarMain.java
@Override public void onBackPressed() { AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.setTitle(getString(R.string.quit_title)); alert.setMessage(getString(R.string.quit_message)); alert.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { finish();//w w w.java 2 s . c o m } }); alert.setNegativeButton(android.R.string.no, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { // } }); alert.show(); }
From source file:com.webileapps.fragments.CordovaFragment.java
/** * Display an error dialog and optionally exit application. *///from ww w . ja va2 s .c o m public void displayError(final String title, final String message, final String button, final boolean exit) { final CordovaFragment me = this; me.getActivity().runOnUiThread(new Runnable() { public void run() { try { AlertDialog.Builder dlg = new AlertDialog.Builder(me.getActivity()); dlg.setMessage(message); dlg.setTitle(title); dlg.setCancelable(false); dlg.setPositiveButton(button, new AlertDialog.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); if (exit) { getActivity().finish(); } } }); dlg.create(); dlg.show(); } catch (Exception e) { getActivity().finish(); } } }); }