List of usage examples for android.app AlertDialog.Builder setOnCancelListener
public void setOnCancelListener(@Nullable OnCancelListener listener)
From source file:angeloid.sopiane.vegaphoneinfo.Tab_MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.tab_main);/*from w w w. j a v a 2 s.c o m*/ // typeface caching initializeTypefaces(); mViewPager = (ViewPager) findViewById(R.id.viewpager); mTabs = (SwipeyTabs) findViewById(R.id.swipeytabs); tabtextview = (TextView) findViewById(R.id.tabtextview); f = (LinearLayout) findViewById(R.id.main_layout2); SwipeyTabsPagerAdapter adapter = new SwipeyTabsPagerAdapter(this, getSupportFragmentManager()); mViewPager.setAdapter(adapter); mTabs.setAdapter(adapter); mViewPager.setOnPageChangeListener(mTabs); mViewPager.setCurrentItem(0); // . // Root permission check! if (!(new File("/system/bin/su").exists()) && !(new File("/system/xbin/su").exists()) && !(new File("/system/bin/busybox").exists())) { // Print Root error message AlertDialog.Builder builder = new Builder(Tab_MainActivity.this); builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface d, int w) { finish(); } }); builder.setOnCancelListener(new DialogInterface.OnCancelListener() { public void onCancel(DialogInterface d) { finish(); } }); builder.setMessage(String.format(getString(R.string.noroot))); builder.create().show(); return; } // Busybox . // Busybox check! if (!(new File("/system/bin/busybox").exists()) && !(new File("/system/xbin/busybox").exists())) { // Print busybox error message AlertDialog.Builder builder = new Builder(Tab_MainActivity.this); builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface d, int w) { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://search?q=busybox")); startActivity(intent); overridePendingTransition(R.anim.fade, R.anim.hold); } }); builder.setOnCancelListener(new DialogInterface.OnCancelListener() { public void onCancel(DialogInterface d) { finish(); } }); builder.setMessage(R.string.busybox); builder.create().show(); return; } }
From source file:angeloid.dreamnarae.Tab_MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.tab_main);//ww w. j a va2 s .co m // typeface caching initializeTypefaces(); mViewPager = (ViewPager) findViewById(R.id.viewpager); mTabs = (SwipeyTabs) findViewById(R.id.swipeytabs); tabtextview = (TextView) findViewById(R.id.tabtextview); f = (LinearLayout) findViewById(R.id.main_layout2); SwipeyTabsPagerAdapter adapter = new SwipeyTabsPagerAdapter(this, getSupportFragmentManager()); mViewPager.setAdapter(adapter); mTabs.setAdapter(adapter); mViewPager.setOnPageChangeListener(mTabs); mViewPager.setCurrentItem(0); // . // Root permission check! if (!(new File("/system/bin/su").exists()) && !(new File("/system/xbin/su").exists()) && !(new File("/system/bin/busybox").exists())) { // Print Root error message AlertDialog.Builder builder = new Builder(Tab_MainActivity.this); builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface d, int w) { finish(); } }); builder.setOnCancelListener(new DialogInterface.OnCancelListener() { public void onCancel(DialogInterface d) { finish(); } }); builder.setMessage(String.format(getString(R.string.tab_tab2_noroot))); builder.create().show(); return; } // Busybox . // Busybox check! if (!(new File("/system/bin/busybox").exists()) && !(new File("/system/xbin/busybox").exists())) { // Print busybox error message AlertDialog.Builder builder = new Builder(Tab_MainActivity.this); builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface d, int w) { Uri uri = Uri.parse("market://search?q=pname:com.jrummy.busybox.installer"); Intent it = new Intent(Intent.ACTION_VIEW, uri); startActivity(it); overridePendingTransition(R.anim.fade, R.anim.hold); } }); builder.setOnCancelListener(new DialogInterface.OnCancelListener() { public void onCancel(DialogInterface d) { finish(); } }); builder.setMessage(R.string.tab_tab2_busybox); builder.create().show(); return; } AlertDialog alert = new AlertDialog.Builder(this).setIcon(R.drawable.alerterror) // alerterror .setTitle(R.string.tab_tab1_alerttitle) // alerttitle .setMessage(R.string.tab_tab1_alertmessage) // .setPositiveButton(R.string.tab_tab1_alertok, new DialogInterface.OnClickListener() // OK ( ) { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); // } }).setNegativeButton(R.string.tab_tab1_alertno, new DialogInterface.OnClickListener() // No { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); finish(); // } }).show(); }
From source file:tw.jwzhuang.ipcamviewer.devices.CaptureActivity.java
private void displayFrameworkBugMessageAndExit() { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(getString(R.string.app_name)); builder.setPositiveButton(R.string.yes, new FinishListener(this)); builder.setOnCancelListener(new FinishListener(this)); builder.show();/*from www . j a v a2 s . com*/ }
From source file:org.thoughtcrime.securesms.SingleContactSelectionListFragment.java
private void addMultipleNumberContact(ContactData contactData, TextView textView) { String[] options = new String[contactData.numbers.size()]; int i = 0;//from ww w . ja v a 2 s.c o m for (NumberData option : contactData.numbers) { options[i++] = option.type + " " + option.number; } AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setTitle(R.string.ContactSelectionlistFragment_select_for + " " + contactData.name); builder.setSingleChoiceItems(options, -1, new DiscriminatorClickedListener(contactData)); //builder.setPositiveButton(android.R.string.ok, new DiscriminatorFinishedListener(contactData, textView)); builder.setOnCancelListener(new DiscriminatorFinishedListener(contactData, textView)); builder.show(); }
From source file:im.vector.activity.CommonActivityUtils.java
public static AlertDialog createEditTextAlert(Activity context, String title, String hint, String initialText, final OnSubmitListener listener) { final AlertDialog.Builder alert = new AlertDialog.Builder(context); final EditText input = new EditText(context); if (hint != null) { input.setHint(hint);/*from w w w. ja va 2 s . c o m*/ } if (initialText != null) { input.setText(initialText); } alert.setTitle(title); alert.setView(input); alert.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { String value = input.getText().toString().trim(); listener.onSubmit(value); } }); alert.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { dialog.cancel(); } }); alert.setOnCancelListener(new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { listener.onCancelled(); } }); AlertDialog dialog = alert.create(); // add the dialog to be rendered in the screenshot RageShake.getInstance().registerDialog(dialog); return dialog; }
From source file:com.androidquery.auth.GoogleHandle.java
private void accountDialog() { AlertDialog.Builder builder = new AlertDialog.Builder(act); //builder.setTitle("Select a Google account"); accs = am.getAccountsByType("com.google"); int size = accs.length; if (size == 1) { auth(accs[0]);/*from w w w .ja v a 2 s . com*/ } else { String[] names = new String[size]; for (int i = 0; i < size; i++) { names[i] = accs[i].name; } builder.setItems(names, this); builder.setOnCancelListener(this); AlertDialog dialog = builder.create();//.show(); new AQuery(act).show(dialog); } }
From source file:com.abhi.barcode.frag.libv2.BarcodeFragment.java
private void displayFrameworkBugMessageAndExit() { AlertDialog.Builder builder = new AlertDialog.Builder(this.getActivity()); builder.setTitle(getString(R.string.app_name)); builder.setMessage("Sorry, the Android camera encountered a problem. You may need to restart the device."); builder.setPositiveButton("OK", new FinishListener(this.getActivity())); builder.setOnCancelListener(new FinishListener(this.getActivity())); builder.show();//w ww .j a va 2 s . co m }
From source file:com.cl.slack.gesture.GestureBuilderActivity.java
private Dialog createRenameDialog() { final View layout = View.inflate(this, R.layout.dialog_rename, null); mInput = (EditText) layout.findViewById(R.id.name); ((TextView) layout.findViewById(R.id.label)).setText(R.string.gestures_rename_label); AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setIcon(0);/*from w ww . j a v a 2s . co m*/ builder.setTitle(getString(R.string.gestures_rename_title)); builder.setCancelable(true); builder.setOnCancelListener(new Dialog.OnCancelListener() { public void onCancel(DialogInterface dialog) { cleanupRenameDialog(); } }); builder.setNegativeButton(getString(R.string.cancel_action), new Dialog.OnClickListener() { public void onClick(DialogInterface dialog, int which) { cleanupRenameDialog(); } }); // builder.setNeutralButton(getString(R.string.cancel_action), // new Dialog.OnClickListener() { // public void onClick(DialogInterface dialog, int which) { // cleanupRenameDialog(); // } // } // ); builder.setPositiveButton(getString(R.string.rename_action), new Dialog.OnClickListener() { public void onClick(DialogInterface dialog, int which) { changeGestureName(); } }); builder.setView(layout); return builder.create(); }
From source file:com.googlecode.android_scripting.facade.ui.NFCBeamTask.java
private Builder addOnCancelListener(final AlertDialog.Builder builder, final Activity activity) { return builder.setOnCancelListener(new DialogInterface.OnCancelListener() { @Override/*from ww w .j av a 2 s .c o m*/ public void onCancel(DialogInterface dialog) { mResultMap.put("canceled", true); setResult("self", "canceled"); } }); }
From source file:com.github.barcodeeye.scan.CaptureActivity.java
/** * FIXME: This should be a glass compatible view (Card) *///w w w .ja v a 2s . com private void displayFrameworkBugMessageAndExit() { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(getString(R.string.app_name)); builder.setMessage(getString(R.string.msg_camera_framework_bug)); builder.setPositiveButton(R.string.button_ok, new FinishListener(this)); builder.setOnCancelListener(new FinishListener(this)); builder.show(); }