List of usage examples for android.app AlertDialog cancel
@Override public void cancel()
From source file:Main.java
public static void cancelDialog(AlertDialog alertdialog) { try {//from w w w .j av a 2 s . c o m alertdialog.cancel(); return; } catch (Exception exception) { return; } }
From source file:Main.java
public static void showAlertDialog(Context context, String title, String message) { AlertDialog dialog = new AlertDialog.Builder(context).create(); dialog.setCancelable(true);//from w ww. jav a2s .c o m dialog.setMessage(message); dialog.setTitle(title); dialog.setButton(DialogInterface.BUTTON_POSITIVE, "OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }); dialog.show(); }
From source file:us.parshall.ezandroid.activity.EZActivity.java
@Override public void onStop() { AlertDialog[] alertDialogList = this.alertDialogList(); if (alertDialogList != null) { for (AlertDialog dialog : this.alertDialogList()) { if (dialog != null) { dialog.cancel(); }// www .j a v a 2s . c o m } } super.onStop(); }
From source file:org.sigimera.app.android.MainActivity.java
/** * Shows the about dialog./*from w w w. j a v a2 s . co m*/ */ public final void showAboutDialog() { AlertDialog dialog = new AlertDialog.Builder(MainActivity.this).create(); dialog.setTitle("About"); dialog.setButton(AlertDialog.BUTTON_POSITIVE, "OK", new DialogInterface.OnClickListener() { @Override public void onClick(final DialogInterface dialog, final int which) { dialog.cancel(); } }); WebView wv = new WebView(this); wv.setBackgroundColor(Color.BLACK); StringBuffer strbuffer = new StringBuffer(); strbuffer.append("<small><font color='white'>"); strbuffer.append("<h3 style='text-align: center'>" + this.getString(R.string.app_name) + "</h3>"); strbuffer.append("<p>This is the official App of the Crises " + "Information Platform Sigimera. It provides " + "the following functionality:</p>"); strbuffer.append("<ul>"); strbuffer.append("<li>Get crises (natural disaster) information." + "Currently floods, earthquakes, cyclones " + "and volcanic erruptions.</li>"); strbuffer.append("<li>Get crises alerts via push notifications.</li>"); strbuffer.append("<li>Get new crises via push notifications.</li>"); strbuffer.append("<li>Manage your App via " + "<a href='http://www.sigimera.org/mobile_devices'>" + "<span style='color: #00FFFF'>mobile device management" + "website </span></a>."); strbuffer.append("</ul>"); strbuffer.append("<p>© 2013 <a href='http://www.sigimera.com'>" + "<span style='color: #00FFFF'>Sigimera Ltd.</span></a>. " + "All rights reserved.</p>"); wv.loadData(strbuffer.toString(), "text/html", "utf-8"); dialog.setView(wv); dialog.show(); }
From source file:azad.hallaji.farzad.com.masirezendegi.PageVirayesh.java
private void jostaruzunueymahziba(String message) { LayoutInflater inflater = this.getLayoutInflater(); View dialogView = inflater.inflate(R.layout.alert_dialog_login, null); final AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this); dialogBuilder.setView(dialogView);//w w w .j a v a 2 s .c o m TextView textView = (TextView) dialogView.findViewById(R.id.aaT); TextView textVie = (TextView) dialogView.findViewById(R.id.aT); textView.setText(message); textVie.setVisibility(View.INVISIBLE); Button button = (Button) dialogView.findViewById(R.id.buttombastan); final AlertDialog alertDialog = dialogBuilder.create(); alertDialog.show(); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { alertDialog.cancel(); /*Intent intent = new Intent(PageVirayesh.this,PageVirayesh.class); startActivity(intent);*/ } }); }
From source file:org.cloudfoundry.android.cfdroid.services.ServiceEditDialogFragment.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { LayoutInflater inflater = LayoutInflater.from(getActivity()); final View v = inflater.inflate(R.layout.service_edit, null); choices = (Spinner) v.findViewById(R.id.type); name = (EditText) v.findViewById(R.id.name); getLoaderManager().initLoader(0, null, this); name.setOnEditorActionListener(new OnEditorActionListener() { public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == IME_ACTION_DONE && ready()) { createService();//from w w w. j a v a 2s . com return true; } return false; } }); name.addTextChangedListener(new BaseTextWatcher() { @Override public void afterTextChanged(Editable s) { updateEnablement(); } }); final AlertDialog dialog = new AlertDialog.Builder(getActivity()) .setTitle(R.string.edit_service_dialog_title).setView(v).setCancelable(true) .setPositiveButton(R.string.create, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); createService(); } }).setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }).create(); // workaround for http://code.google.com/p/android/issues/detail?id=6360 // ... dialog.setOnShowListener(new OnShowListener() { @Override public void onShow(DialogInterface di) { okButton = dialog.getButton(AlertDialog.BUTTON_POSITIVE); updateEnablement(); } }); return dialog; }
From source file:org.rm3l.ddwrt.tiles.DDWRTTile.java
@Override public final void onClick(View view) { final OnClickIntent onClickIntentAndListener = getOnclickIntent(); final Intent onClickIntent; if (onClickIntentAndListener != null && (onClickIntent = onClickIntentAndListener.getIntent()) != null) { final String dialogMsg = onClickIntentAndListener.getDialogMessage(); //noinspection ConstantConditions final AlertDialog alertDialog = Utils.buildAlertDialog(mParentFragmentActivity, null, Strings.isNullOrEmpty(dialogMsg) ? "Loading detailed view..." : dialogMsg, false, false); alertDialog.show();// ww w . j a v a 2 s .co m ((TextView) alertDialog.findViewById(android.R.id.message)).setGravity(Gravity.CENTER_HORIZONTAL); new Handler().postDelayed(new Runnable() { @Override public void run() { ((DDWRTBaseFragment) mParentFragment).startActivityForResult(onClickIntent, onClickIntentAndListener.getListener()); alertDialog.cancel(); } }, 2500); } }
From source file:ca.ualberta.app.activity.CreateQuestionActivity.java
public void viewQuestionImage(View view) { LayoutInflater inflater = LayoutInflater.from(view.getContext()); View imgEntryView = inflater.inflate(R.layout.dialog_photo, null); final AlertDialog dialog = new AlertDialog.Builder(view.getContext()).create(); ImageView img = (ImageView) imgEntryView.findViewById(R.id.large_image); img.setImageBitmap(image);/* w ww. j a va2s. com*/ dialog.setView(imgEntryView); dialog.show(); imgEntryView.setOnClickListener(new OnClickListener() { public void onClick(View paramView) { dialog.cancel(); } }); }
From source file:com.example.parking.ParkingInformationActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mDBAdapter = new DBAdapter(this); setContentView(R.layout.activity_parking_information); mParkNameTV = (TextView) findViewById(R.id.tv_parking_name); mParkNameTV.setText(R.string.park_name_fixed); mParkNumberTV = (TextView) findViewById(R.id.tv_parking_number); mParkNumberTV.setText("?:" + this.getString(R.string.park_number_fixed)); mCarType = (Spinner) findViewById(R.id.sp_car_type); mParkingType = (Spinner) findViewById(R.id.sp_parking_type); mLocationNumber = (Spinner) findViewById(R.id.sp_parking_location); mLicensePlateNumberTV = (TextView) findViewById(R.id.tv_license_plate_number); Intent intent = getIntent();/* w w w. j a va 2s . co m*/ Bundle bundle = intent.getExtras(); mLicensePlateNumberTV.setText(bundle.getString("licensePlate")); mStartTime = (TextView) findViewById(R.id.tv_start_time_arriving); new TimeThread().start(); mOkButton = (Button) findViewById(R.id.bt_confirm_arriving); mOkButton.setOnClickListener(new InsertOnclickListener(mLicensePlateNumberTV.getText().toString(), mCarType.getSelectedItem().toString(), mParkingType.getSelectedItem().toString(), Integer.parseInt(mLocationNumber.getSelectedItem().toString()), DateFormat.format("yyyy-MM-dd HH:mm:ss", System.currentTimeMillis()).toString(), null, null, "")); mPhotoBT = (Button) findViewById(R.id.bt_camera_arriving); mPhotoBT.setOnClickListener(new Button.OnClickListener() { @Override public void onClick(View v) { if (mEnterImage != null) { Toast.makeText(getApplicationContext(), "?", Toast.LENGTH_SHORT) .show(); } else { openTakePhoto(); } } }); mPhotoTitleTV = (TextView) findViewById(R.id.tv_photo_title_arriving); mEnterImageIV = (ImageView) findViewById(R.id.iv_photo_arriving); mEnterImageIV.setOnClickListener(new Button.OnClickListener() { @Override public void onClick(View v) { LayoutInflater inflater = LayoutInflater.from(getApplicationContext()); View imgEntryView = inflater.inflate(R.layout.dialog_photo_entry, null); // final AlertDialog dialog = new AlertDialog.Builder(ParkingInformationActivity.this).create(); ImageView img = (ImageView) imgEntryView.findViewById(R.id.iv_large_image); Button deleteBT = (Button) imgEntryView.findViewById(R.id.bt_delete_image); img.setImageBitmap(mEnterImage); dialog.setView(imgEntryView); // dialog dialog.show(); imgEntryView.setOnClickListener(new OnClickListener() { public void onClick(View paramView) { dialog.cancel(); } }); deleteBT.setOnClickListener(new OnClickListener() { public void onClick(View paramView) { mEnterImage = null; mEnterImageIV.setImageResource(drawable.ic_photo_background_64px); dialog.cancel(); } }); } }); getActionBar().setDisplayHomeAsUpEnabled(true); IntentFilter filter = new IntentFilter(); filter.addAction("ExitApp"); registerReceiver(mReceiver, filter); }
From source file:ca.ualberta.app.activity.CreateAnswerActivity.java
/** * set the image to the imageView/* www . j a v a 2 s . c o m*/ * * @param view * View passed to the activity to check which button was pressed. */ // http://www.csdn123.com/html/mycsdn20140110/2d/2d3c6d5adb428b6708901f7060d31800.html public void viewAnswerImage(View view) { LayoutInflater inflater = LayoutInflater.from(view.getContext()); View imgEntryView = inflater.inflate(R.layout.dialog_photo, null); final AlertDialog dialog = new AlertDialog.Builder(view.getContext()).create(); ImageView img = (ImageView) imgEntryView.findViewById(R.id.large_image); img.setImageBitmap(image); dialog.setView(imgEntryView); dialog.show(); imgEntryView.setOnClickListener(new OnClickListener() { public void onClick(View paramView) { dialog.cancel(); } }); }