List of usage examples for android.app AlertDialog.Builder setMessage
public void setMessage(CharSequence message)
From source file:com.yozio.demo.implementations.share.ShareButtonsActivity.java
public void showShareCommentDialog(Context context, final DialogFlowController controller) { final EditText text = new EditText(context); text.setMinLines(5);//from ww w .j av a 2s. c o m text.setGravity(Gravity.TOP); AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setTitle("Share"); builder.setMessage("Enter a comment (Optional)"); builder.setPositiveButton("OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { controller.onContinue(text.getText().toString()); } }); builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { controller.onCancel(); } }); AlertDialog dialog = builder.create(); dialog.setView(text); dialog.show(); }
From source file:com.gmail.at.faint545.fragments.HistoryFragment.java
private AlertDialog buildAlertDialog() { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setMessage(R.string.connect_error); builder.setCancelable(false);//from www .j av a 2 s .c om builder.setNegativeButton(R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }); return builder.create(); }
From source file:de.trier.infsec.koch.droidsheep.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);/*from ww w .j a va2 s. com*/ 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:com.androidhacks7.apprtc_android.RegistrationActivity.java
private void showUserDialog(int type, final Object... args) { AlertDialog.Builder builder = new AlertDialog.Builder(this); if (type == AppConstants.DIALOG_USERNAME) { builder.setMessage("Enter User Name: "); userName = new EditText(this); RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT); userName.setLayoutParams(lp);//from w w w. j a v a2s .c o m builder.setView(userName); builder.setPositiveButton("Enter", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { register(); } }); builder.setNegativeButton("Quit", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { finish(); } }); } else if (type == 1) { try { final JSONObject jsonObject = new JSONObject(args[0].toString()); builder.setMessage("Incoming call from " + jsonObject.get(JSONConstants.CALLER)); builder.setPositiveButton("Attend", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { Intent intent = new Intent(RegistrationActivity.this, VideoCallActivity.class); intent.putExtra(JSONConstants.CALL_PARAMS, args[0].toString()); startActivity(intent); finish(); } }); builder.setNegativeButton("Decline", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { Intent intent = new Intent(RegistrationActivity.this, VideoCallActivity.class); intent.putExtra(JSONConstants.CALL_PARAMS, args[0].toString()); intent.putExtra(JSONConstants.REJECT_CALL, args[0].toString()); startActivity(intent); } }); } catch (JSONException e) { e.printStackTrace(); } } builder.create().show(); }
From source file:com.intel.xdk.notification.Notification.java
public void alert(String message, String title, String button) { if (button == null || button.length() == 0 || button.equals("undefined")) button = "OK"; AlertDialog.Builder alertBldr = new AlertDialog.Builder(activity); alertBldr.setMessage(message); alertBldr.setTitle((title == null || title.length() == 0 || title.equals("undefined")) ? "Alert" : title); alertBldr.setPositiveButton(button, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { }//from w w w.j a v a 2 s . co m }); alertBldr.show(); }
From source file:com.eTilbudsavis.sdkdemo.CatalogViewer.java
private void dialog(String title, String message) { AlertDialog.Builder b = new Builder(CatalogViewer.this); b.setTitle(title);// w w w .j a v a 2 s. c o m b.setMessage(message); b.setPositiveButton("OK", new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); b.show(); }
From source file:com.gigathinking.simpleapplock.ResetUnlockMethod.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.layout_reset); getActionBar().setDisplayHomeAsUpEnabled(true); mDialog = new ProgressDialog(this, ProgressDialog.STYLE_SPINNER); mDialog.setIndeterminate(true);//from w w w. jav a 2 s . c o m prefs = PreferenceManager.getDefaultSharedPreferences(this); mResetReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { prefs.edit().putString(AppLockApplication.LOCKTYPE, AppLockApplication.LOCKTYPE_PIN).commit(); prefs.edit() .putString(AppLockApplication.PASSWORD, intent.getStringExtra(AppLockApplication.PASSWORD)) .commit(); Toast.makeText(context, getString(R.string.pin_reset), Toast.LENGTH_LONG).show(); startActivity(new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_HOME) .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)); //startActivity(new Intent(ResetUnlockMethod.this,UnlockWithPIN.class).putExtra("test","test")); finish(); } }; LocalBroadcastManager.getInstance(this).registerReceiver(mResetReceiver, new IntentFilter(AppLockApplication.RESET_UNLOCK)); if (!PreferenceManager.getDefaultSharedPreferences(this).getBoolean(getString(R.string.register_complete), false)) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setMessage(getString(R.string.reset_register_device)); builder.setTitle(getString(R.string.info)); builder.setPositiveButton(getString(R.string.register), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { new Register().execute(); if (mDialog != null) { mDialog.setMessage(getString(R.string.register_ongoing)); mDialog.show(); } dialog.dismiss(); } }); builder.setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); finish(); Intent intent = new Intent(Intent.ACTION_MAIN); intent.addCategory(Intent.CATEGORY_HOME); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); } }); builder.create().show(); } else { if (mDialog != null) { mDialog.setMessage(getString(R.string.connect_to_server)); mDialog.show(); } new DoRequestReset().execute(); } }
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 ww . ja v a 2s . co 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:ua.naiksoftware.chars.Sender.java
@Override protected void onPreExecute() { Log.d(tag, "onPreExecute begin"); ProgressBar progressBar = new ProgressBar(EngineActivity.CONTEXT); progressBar.setIndeterminate(true);/* w w w. ja v a 2s . c o m*/ AlertDialog.Builder builder = new AlertDialog.Builder(EngineActivity.CONTEXT); builder.setCustomTitle(progressBar); builder.setIcon(android.R.drawable.ic_menu_upload); builder.setMessage(R.string.send_record); builder.setCancelable(false); dialog = builder.create(); dialog.show(); Log.d(tag, "onPreExecute end"); }
From source file:com.mono.applink.Facebook.java
/** Called when the activity is first created. */ @Override/*from ww w.j ava 2 s . c o m*/ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); context = this; final String url = getIntent().getData().toString(); if (url.contains("posts") || url.contains("profile.php") || (!url.contains("&") && !url.contains("=") && url.length() > 24)) //1)Posts->It is impossible to launch FeedbackActivity because of permission denied. //With root permission and "am start" it's impossible to pass a Long extra_key... //2)Profile //3)Nickname { new FacebookUser().execute(); } else if (url.contains("sk=inbox"))//Message { new FacebookMessage().execute(); } else if (url.contains("event.php"))//event { new FacebookEvent().execute(); } else { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setMessage("Sorry, but this type of link is not currently supported"); builder.setOnCancelListener(new OnCancelListener() { public void onCancel(DialogInterface dialog) { finish(); } }); builder.setPositiveButton("Open in Browser", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { Intent i = new Intent(); i.setAction("android.intent.action.VIEW"); i.addCategory("android.intent.category.BROWSABLE"); i.setComponent(new ComponentName("com.android.browser", "com.android.browser.BrowserActivity")); i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); i.setData(Uri.parse(url)); startActivity(i); finish(); } }); AlertDialog alert = builder.create(); alert.show(); } }