List of usage examples for android.app AlertDialog.Builder setTitle
@Override public void setTitle(CharSequence title)
From source file:com.abc.driver.TruckActivity.java
/** * edit portait/* w w w. j a v a 2s . c o m*/ * * @param v */ public void editDriverLicense(View v) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(res.getString(R.string.choose_portrait)); builder.setItems(new String[] { res.getString(R.string.getPhotoFromCamera), res.getString(R.string.getPhotoFromMemory) }, new DialogInterface.OnClickListener() { // @Override public void onClick(DialogInterface dialog, int id) { switch (id) { case 0: startToCameraActivity(CellSiteConstants.TAKE_PICTURE); break; case 1: startToMediaActivity(CellSiteConstants.PICK_PICTURE); break; } } }); AlertDialog alert = builder.create(); alert.show(); }
From source file:com.abc.driver.TruckActivity.java
/** * edit portait/*from w ww . ja va 2s . co m*/ * * @param v */ public void editPhotoImage(View v) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(res.getString(R.string.choose_portrait)); builder.setItems(new String[] { res.getString(R.string.getPhotoFromCamera), res.getString(R.string.getPhotoFromMemory) }, new DialogInterface.OnClickListener() { // @Override public void onClick(DialogInterface dialog, int id) { switch (id) { case 0: startToCameraActivity(CellSiteConstants.TAKE_PICTURE2); break; case 1: startToMediaActivity(CellSiteConstants.PICK_PICTURE2); break; } } }); AlertDialog alert = builder.create(); alert.show(); }
From source file:de.ub0r.android.callmeter.ui.prefs.Preferences.java
/** * Reset internal Logs./*from www . ja v a2 s . co m*/ */ private void resetDataDialog() { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(R.string.reset_data_); builder.setMessage(R.string.reset_data_hint); builder.setCancelable(false); builder.setPositiveButton(android.R.string.yes, new OnClickListener() { @Override public void onClick(final DialogInterface dialog, final int which) { Preferences.this.resetData(DataProvider.TYPE_CALL); Preferences.this.resetData(DataProvider.TYPE_SMS); Preferences.this.resetData(DataProvider.TYPE_MMS); } }); builder.setNeutralButton(R.string.reset_data_data_, new OnClickListener() { @Override public void onClick(final DialogInterface dialog, final int which) { Preferences.this.resetData(-1); } }); builder.setNegativeButton(android.R.string.no, null); builder.show(); }
From source file:com.openerp.MainActivity.java
public Dialog accountSelectionDialog(final List<OEUser> accounts) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(R.string.title_select_account) .setSingleChoiceItems(accountList(accounts), 1, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { mAccount = accounts.get(which); }/*from ww w .j av a2 s .c o m*/ }).setNeutralButton(R.string.label_new, new OnClickListener() { public void onClick(DialogInterface dialog, int which) { getActionBar().setDisplayHomeAsUpEnabled(false); getActionBar().setHomeButtonEnabled(false); AccountFragment fragment = new AccountFragment(); startMainFragment(fragment, false); } }) // Set the action buttons .setPositiveButton(R.string.label_login, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { if (mAccount != null) { OpenERPAccountManager.loginUser(mContext, mAccount.getAndroidName()); } else { Toast.makeText(mContext, "Please select account", Toast.LENGTH_LONG).show(); } init(); } }).setNegativeButton(R.string.label_cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { finish(); } }); return builder.create(); }
From source file:com.irccloud.android.activity.UploadsActivity.java
public void onIRCEvent(int what, Object o) { IRCCloudJSONObject obj;//from ww w. j a v a 2 s. co m final File f; switch (what) { case NetworkConnection.EVENT_SUCCESS: obj = (IRCCloudJSONObject) o; f = delete_reqids.get(obj.getInt("_reqid")); if (f != null) { Log.d("IRCCloud", "File deleted successfully"); delete_reqids.remove(obj.getInt("_reqid")); runOnUiThread(new Runnable() { @Override public void run() { adapter.removeFile(f); View.OnClickListener undo = new View.OnClickListener() { @Override public void onClick(View view) { NetworkConnection.getInstance().restoreFile(f.id); adapter.restoreFile(f); } }; if (f.name != null && f.name.length() > 0) Snackbar.make(findViewById(android.R.id.list), f.name + " was deleted.", Snackbar.LENGTH_LONG).setAction("UNDO", undo).show(); else Snackbar.make(findViewById(android.R.id.list), "File was deleted.", Snackbar.LENGTH_LONG).setAction("UNDO", undo).show(); } }); } break; case NetworkConnection.EVENT_FAILURE_MSG: obj = (IRCCloudJSONObject) o; f = delete_reqids.get(obj.getInt("_reqid")); if (f != null) { delete_reqids.remove(obj.getInt("_reqid")); Crashlytics.log(Log.ERROR, "IRCCloud", "Delete failed: " + obj.toString()); runOnUiThread(new Runnable() { @Override public void run() { AlertDialog.Builder builder = new AlertDialog.Builder(UploadsActivity.this); builder.setTitle("Error"); if (f.name != null && f.name.length() > 0) builder.setMessage("Unable to delete '" + f.name + "'. Please try again shortly."); else builder.setMessage("Unable to delete file. Please try again shortly."); builder.setPositiveButton("Close", null); builder.show(); f.deleting = false; adapter.notifyDataSetChanged(); } }); } break; default: break; } }
From source file:com.dvn.vindecoder.ui.seller.AddVehicalAndPayment.java
private void startDilog() { AlertDialog.Builder myAlertDilog = new AlertDialog.Builder(AddVehicalAndPayment.this); myAlertDilog.setTitle("Upload picture option.."); myAlertDilog.setMessage("Take Photo"); myAlertDilog.setPositiveButton("Gallery", new DialogInterface.OnClickListener() { @Override//from w w w .ja v a2 s .c o m public void onClick(DialogInterface dialog, int which) { Intent picIntent = new Intent(Intent.ACTION_GET_CONTENT, null); picIntent.setType("image/*"); picIntent.putExtra("return_data", true); startActivityForResult(picIntent, GALLERY_REQUEST); } }); myAlertDilog.setNegativeButton("Camera", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { if (checkPermission(Manifest.permission.CAMERA, AddVehicalAndPayment.this)) { openCameraApplication(); } else { requestPermission(AddVehicalAndPayment.this, new String[] { Manifest.permission.CAMERA }, REQUEST_ACESS_CAMERA); } } else { openCameraApplication(); } } }); myAlertDilog.show(); }
From source file:net.evecom.android.web.Web5Activity.java
/** * //from w w w . j a v a 2 s. co m * * @param v */ public void message_post_web_tomain(View v) { AlertDialog.Builder builder1 = new AlertDialog.Builder(Web5Activity.this); builder1.setTitle(""); builder1.setIcon(R.drawable.qq_dialog_default_icon);// builder1.setMessage(""); builder1.setPositiveButton("", new DialogInterface.OnClickListener() { // @Override public void onClick(DialogInterface dialog, int which) { finish(); } }); builder1.setNegativeButton("", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }); builder1.show(); }
From source file:bizapps.com.healthforusPatient.activity.RegisterActivity.java
private void selectImage() { final CharSequence[] items = { "Take Photo", "Choose from Library", "Cancel" }; android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(RegisterActivity.this); builder.setTitle("Add Photo!"); builder.setItems(items, new DialogInterface.OnClickListener() { @Override/* w w w .j av a 2 s . c o m*/ public void onClick(DialogInterface dialog, int item) { boolean result = UtilNew.checkPermission(RegisterActivity.this); if (items[item].equals("Take Photo")) { userChoosenTask = "Take Photo"; if (result) cameraIntent(); } else if (items[item].equals("Choose from Library")) { userChoosenTask = "Choose from Library"; if (result) galleryIntent(); } else if (items[item].equals("Cancel")) { dialog.dismiss(); } } }); builder.show(); }
From source file:course1778.mobileapp.safeMedicare.Main.FamMemFrag.java
private void add() { LayoutInflater inflater = getActivity().getLayoutInflater(); View addView = inflater.inflate(R.layout.add_edit, null); //AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); AlertDialog.Builder builder = new AlertDialog.Builder( new ContextThemeWrapper(getContext(), R.style.AlertDialogCustom)); builder.setTitle(R.string.add_title).setView(addView).setPositiveButton(R.string.ok, this) .setNegativeButton(R.string.cancel, null).show(); Spinner spin = (Spinner) addView.findViewById(R.id.spinner); //spin.setOnItemSelectedListener(FamMemActivity.getContext()); ArrayAdapter<String> aa = new ArrayAdapter<String>(FamMemActivity.getContext(), R.layout.spinner_item_text, items);// ww w . j av a2 s . c om aa.setDropDownViewResource(R.layout.spinner_dropdown_item); spin.setAdapter(aa); // field for user adding medication name textView = (AutoCompleteTextView) addView.findViewById(R.id.title); /** sheet 1 displays all the drug interactions; * sheet 2 displays the list of all drugs */ crsList = med_list.rawQuery("SELECT * FROM Sheet1", null); crsInteractions = med_interaction.rawQuery("SELECT * FROM DrugDrug", null); String[] array = new String[crsList.getCount()]; int i = 0; while (crsList.moveToNext()) { String uname = crsList.getString(crsList.getColumnIndex("Name")); array[i] = uname; i++; } // Create the adapter and set it to the AutoCompleteTextView ArrayAdapter<String> adapter = new ArrayAdapter<String>(FamMemActivity.getContext(), R.layout.listlayout, R.id.listTextView, array); textView.setAdapter(adapter); }
From source file:net.evecom.android.web.Web4Activity.java
/** * /*from w w w . j a va 2s.c om*/ * * @param v */ public void message_post_web_tomain(View v) { AlertDialog.Builder builder1 = new AlertDialog.Builder(Web4Activity.this); builder1.setTitle(""); builder1.setIcon(R.drawable.qq_dialog_default_icon);// builder1.setMessage(""); builder1.setPositiveButton("", new DialogInterface.OnClickListener() { // @Override public void onClick(DialogInterface dialog, int which) { finish(); } }); builder1.setNegativeButton("", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }); builder1.show(); }