List of usage examples for android.app AlertDialog.Builder setTitle
@Override public void setTitle(CharSequence title)
From source file:com.javierc.albuquerquenow.SearchMap.java
@Override public boolean onOptionsItemSelected(MenuItem item) { // TODO Auto-generated method stub if (item.getItemId() == android.R.id.home) { this.finish(); } else if (item.getItemId() == R.id.action_legalnotices) { String LicenseInfo = GooglePlayServicesUtil.getOpenSourceSoftwareLicenseInfo(getApplicationContext()); AlertDialog.Builder LicenseDialog = new AlertDialog.Builder(SearchMap.this); LicenseDialog.setTitle("Legal Notices"); LicenseDialog.setMessage(LicenseInfo); LicenseDialog.show();//from w w w. j a va2 s . c om } return super.onOptionsItemSelected(item); }
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 .j a v a 2s. com 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:com.lepin.activity.AddNewCarActivity.java
/** * ?//from w ww. j a va 2 s. c om */ protected void choicePeoPleNumber() { AlertDialog.Builder builder = new AlertDialog.Builder(AddNewCarActivity.this); builder.setTitle(R.string.pick_details_total_people).setItems(pepNumArry, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { addNum.setText(pepNumArry[which]); } }); builder.create().show(); }
From source file:com.cleanwiz.applock.service.AppUpdateService.java
public void checkVersion() { requestQueue = Volley.newRequestQueue(context); String url = "http://www.toolwiz.com/android/checkfiles.php"; final String oldVersionString = getApplicationVersion(); Uri.Builder builder = Uri.parse(url).buildUpon(); builder.appendQueryParameter("uid", AndroidUtil.getUdid(context)); builder.appendQueryParameter("version", oldVersionString); builder.appendQueryParameter("action", "checkfile"); builder.appendQueryParameter("app", "locklocker"); jsonObjectRequest = new JsonObjectRequest(Request.Method.GET, builder.toString(), null, new Response.Listener<JSONObject>() { @Override//from w ww. j a va2s. c o m public void onResponse(JSONObject arg0) { // TODO Auto-generated method stub LogUtil.e("colin", "success"); if (arg0.has("status")) { try { String status = arg0.getString("status"); if (Integer.valueOf(status) == 1) { JSONObject msgJsonObject = arg0.getJSONObject("msg"); double version = msgJsonObject.getDouble("version"); if (Double.valueOf(oldVersionString) < version) { // ??? String intro = msgJsonObject.getString("intro"); AlertDialog.Builder alert = new AlertDialog.Builder(context); alert.setTitle("?").setMessage(intro) .setPositiveButton("", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // ?? } }) .setNegativeButton("?", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); alert.create().show(); } } else { LogUtil.e("colin", "check update status is error"); } } catch (JSONException e) { // TODO Auto-generated catch block LogUtil.e("colin", "JSONException" + e.getMessage()); e.printStackTrace(); } } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError arg0) { // TODO Auto-generated method stub } }); requestQueue.add(jsonObjectRequest); }
From source file:edu.usf.cutr.opentripplanner.android.serialization.TripRequest.java
protected void onPostExecute(Long result) { if (progressDialog.isShowing()) { progressDialog.dismiss();//from ww w .j a v a 2s.co 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: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);// ww w . java 2 s. c o m 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: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./*from w w w .ja v a 2s .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.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 ww. j av a 2s . c om*/ alert.setPositiveButton("Go", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { HijackActivity.this.webview.loadUrl(inputName.getText().toString()); } }); alert.show(); }
From source file:de.grobox.blitzmail.MainActivity.java
private void addSendNowPref(final Context c) { JSONObject mails = MailStorage.getMails(this); if (mails != null && mails.length() > 0) { PreferenceCategory targetCategory = (PreferenceCategory) findPreference("pref_sending"); Preference pref = new Preference(this); pref.setKey("pref_send_now"); pref.setTitle(R.string.pref_send_now); pref.setSummary(/*from w w w . j a va 2s . c o m*/ String.format(getResources().getString(R.string.pref_send_now_summary), mails.length())); pref.setOnPreferenceClickListener(new OnPreferenceClickListener() { public boolean onPreferenceClick(Preference preference) { if (BuildConfig.PRO) sendNow(); else { AlertDialog.Builder builder = new AlertDialog.Builder(c); builder.setTitle(c.getString(R.string.app_name)); builder.setMessage(c.getString(R.string.error_lite_version)); builder.setIcon(android.R.drawable.ic_dialog_info); // Add the buttons builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { Uri uri = Uri.parse( "https://play.google.com/store/apps/details?id=de.grobox.blitzmail.pro"); Intent intent = new Intent(Intent.ACTION_VIEW, uri); if (intent.resolveActivity(c.getPackageManager()) != null) { c.startActivity(intent); } dialog.dismiss(); } }); builder.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.dismiss(); } }); // Create and show the AlertDialog AlertDialog dialog = builder.create(); dialog.setCanceledOnTouchOutside(false); dialog.show(); } return true; } }); targetCategory.addPreference(pref); } }
From source file:com.github.rutvijkumar.twittfuse.TwitterUtil.java
public void confirmRetweet(final Tweet tweet, final ImageButton rtAction, final TextView rtCount, final boolean hideZero) { if (!tweet.isRetweeted()) { AlertDialog.Builder builder = new AlertDialog.Builder(activity); builder.setTitle("Retweet this to your followers?"); builder.setPositiveButton("Retweet", new DialogInterface.OnClickListener() { @Override//from w ww. j av a 2 s. c o m public void onClick(DialogInterface dialog, int whichButton) { if (!Util.isNetworkAvailable(activity)) { Util.showNetworkUnavailable(activity); } doReTweet(tweet, rtAction, rtCount, hideZero); } }); builder.setNegativeButton("Cancel", null); builder.create().show(); } }