List of usage examples for android.app AlertDialog.Builder setMessage
public void setMessage(CharSequence message)
From source file:br.ufg.inf.es.fs.contpatri.mobile.webservice.EnviarColeta.java
/** * Mtodo que exibe um <code>Dialog</code> caso haja erro no login do * usurio no aplicativo.// w w w.j a va 2 s . c o m */ private void mostrarDialogo() { AlertDialog.Builder builder; builder = new AlertDialog.Builder(activity); builder.setTitle("Erro"); builder.setMessage(mensagem); builder.setIcon(android.R.drawable.ic_dialog_alert); builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() { @Override public void onClick(final DialogInterface dialog, final int which) { dialog.dismiss(); } }); final AlertDialog dialog = builder.create(); dialog.setCanceledOnTouchOutside(true); dialog.show(); }
From source file:com.HskPackage.HskNamespace.HSK1ProjectActivity.java
public void showDef(View v) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setMessage(ssignificato).setCancelable(false).setNegativeButton("Clear", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel();/* w ww. j a v a 2s . c o m*/ } }); AlertDialog alert = builder.create(); alert.show(); }
From source file:it.sasabz.android.sasabus.InfoActivity.java
/** * Called when the activity is about to start interacting with the user. *//*w ww. ja v a 2 s .co m*/ @Override protected void onResume() { super.onResume(); if (haveNetworkConnection()) fillData(); else { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setCancelable(true); builder.setMessage(R.string.no_network_connection); builder.setTitle(R.string.error_title); builder.setNeutralButton(android.R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.cancel(); dialog.dismiss(); } }); builder.create().show(); } }
From source file:com.dipesan.miniatm.miniatm.services.RiskManagementTask.java
@Override public void execute(ITaskMonitor monitor) { this.monitor = monitor; activity.runOnUiThread(new Runnable() { @Override/*from w w w. j a v a2 s . c om*/ public void run() { AlertDialog.Builder builder = new AlertDialog.Builder(activity); builder.setTitle("Risk management"); builder.setCancelable(false); builder.setMessage("Is card stolen ?"); builder.setPositiveButton("Yes", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); end(new byte[] { 0, 0b10000, 0, 0, 0 }); } }); builder.setNegativeButton("No", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); end(new byte[] { 0, 0, 0, 0, 0 }); } }); builder.create().show(); } }); }
From source file:com.loopj.android.http.sample.CustomCASample.java
/** * Displays a dialog showing contents of `custom_ca.txt` file from assets. * This is needed to avoid Lint's strict mode. */// w w w . ja va2 s .c o m private void showCustomCAHelp() { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(R.string.title_custom_ca); builder.setMessage(getReadmeText()); builder.setNeutralButton(android.R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); builder.show(); }
From source file:company.test.Test.java
@Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); switch (id) { case R.id.add_item: AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle("Add a task"); builder.setMessage("What do you want to do?"); final EditText inputField = new EditText(this); builder.setView(inputField);/*from w ww.j a v a2 s. com*/ builder.setPositiveButton("Add", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { String task = inputField.getText().toString(); Log.d("MainActivity", task); SQLiteDatabase db = helper.getWritableDatabase(); ContentValues values = new ContentValues(); values.clear(); values.put(ItemContract.Columns.ITEM, task); db.insertWithOnConflict(ItemContract.TABLE, null, values, SQLiteDatabase.CONFLICT_IGNORE); activity.updateUI(); } }); builder.setNegativeButton("Cancel", null); builder.create().show(); return true; case R.id.action_settings: Log.d("MainActivity", "Settings"); return true; default: return false; } }
From source file:edu.usf.cutr.opentripplanner.android.serialization.TripRequest.java
protected void onPostExecute(Long result) { if (progressDialog.isShowing()) { progressDialog.dismiss();/* w w w.j a v a2 s.c o m*/ } for (int i = 0; i < responses.length; i++) { if (responses[i] != null && responses[i].getPlan() != null && responses[i].getPlan().getItinerary().get(0) != null) { callback.onTripRequestComplete(SUCCESS); Log.d(TAG, "Response " + i + ": " + SUCCESS); } else { // TODO - handle errors here? if (responses[i] != null && responses[i].getError() != null) { String msg = String.valueOf(responses[i].getError().getId()); AlertDialog.Builder feedback = new AlertDialog.Builder(context); feedback.setTitle("Error Planning Trip"); feedback.setMessage(msg); feedback.setNeutralButton("OK", null); feedback.create().show(); } callback.onTripRequestComplete(FAILURE); Log.e(TAG, "Response " + i + ": " + FAILURE); } } callback.onTripBatchRequestComplete(responses); }
From source file:com.springsource.greenhouse.WebOAuthActivity.java
private void displayAppAuthorizationError(String message) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setMessage(message); builder.setCancelable(false);/*from w ww . ja v a 2 s .com*/ builder.setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { signOut(); } }); AlertDialog alert = builder.create(); alert.show(); }
From source file:edu.cwru.apo.Directory.java
public void onClick(View v) { switch (v.getId()) { case R.id.btnCall: Intent intent = new Intent(Intent.ACTION_CALL); intent.setData(Uri.parse("tel:" + lastPhone)); startActivity(intent);//from www . ja va 2 s.c o m break; case R.id.btnText: startActivity(new Intent(Intent.ACTION_VIEW, Uri.fromParts("sms", lastPhone, null))); break; default: String text = ((TextView) v).getText().toString(); int start = text.lastIndexOf('['); int end = text.lastIndexOf(']'); String caseID = text.substring(start + 1, end); Cursor results = database.query("phoneDB", new String[] { "first", "last", "_id", "phone" }, "_id = ?", new String[] { caseID }, null, null, null); if (results.getCount() != 1) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setMessage("Error Loading Phone Number").setCancelable(false).setNeutralButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); AlertDialog alert = builder.create(); alert.show(); } else { results.moveToFirst(); phoneDialog = new Dialog(this); phoneDialog.setContentView(R.layout.phone_dialog); phoneDialog.setTitle(results.getString(0) + " " + results.getString(1)); TextView phoneText = (TextView) phoneDialog.findViewById((R.id.phoneText)); String phoneNumber = removeNonDigits(results.getString(3)); if (phoneNumber == null || phoneNumber.trim().equals("") || phoneNumber.trim().equals("null")) { ((Button) phoneDialog.findViewById(R.id.btnCall)).setEnabled(false); ((Button) phoneDialog.findViewById(R.id.btnText)).setEnabled(false); phoneNumber = "not available"; } else { ((Button) phoneDialog.findViewById(R.id.btnCall)).setEnabled(true); ((Button) phoneDialog.findViewById(R.id.btnText)).setEnabled(true); ((Button) phoneDialog.findViewById(R.id.btnCall)).setOnClickListener(this); ((Button) phoneDialog.findViewById(R.id.btnText)).setOnClickListener(this); } lastPhone = phoneNumber; phoneText.setText("Phone Number: " + lastPhone); phoneDialog.show(); } break; } }
From source file:com.zbrown.droidsteal.activities.HijackActivity.java
private void selectURL() { AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.setTitle(getString(R.string.changeurl)); alert.setMessage(getString(R.string.customurl)); // Set an EditText view to get user input final EditText inputName = new EditText(this); inputName.setText(HijackActivity.this.webview.getUrl()); alert.setView(inputName);/*w w w .j a v a2 s . c om*/ alert.setPositiveButton("Go", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { HijackActivity.this.webview.loadUrl(inputName.getText().toString()); } }); alert.show(); }