List of usage examples for android.app AlertDialog.Builder setMessage
public void setMessage(CharSequence message)
From source file:com.sourcey.materiallogindemo.PostItemActivity.java
private void DialogMap() { View dialogBoxView = View.inflate(this, R.layout.activity_map, null); final WebView map = (WebView) dialogBoxView.findViewById(R.id.webView); String url = getString(R.string.url_map) + "index.php?poinFrom=" + strStart + "&poinTo=" + strEnd; map.getSettings().setLoadsImagesAutomatically(true); map.getSettings().setJavaScriptEnabled(true); map.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY); map.loadUrl(url);//from w w w.j a v a 2 s .c om AlertDialog.Builder builderInOut = new AlertDialog.Builder(this); builderInOut.setTitle("?"); builderInOut.setMessage("").setView(dialogBoxView).setCancelable(false) .setPositiveButton("Close", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }).show(); }
From source file:com.citrus.sdk.fragments.SavedOptions.java
private void showPopup() { final String email = OneClicksignup.getDefaultGmail(getActivity()); final BooleanTask ontask = new BooleanTask() { @Override//from w w w . j a v a2s . c o m public void ontaskComplete(boolean result) { if (result) { Toast.makeText(getActivity().getApplicationContext(), "An Email has been sent to you", Toast.LENGTH_SHORT).show(); } } }; final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setTitle("Reset Password?"); builder.setMessage("An email will be sent to " + email); builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { new ResetPassword(getActivity(), email, ontask).execute(); } }); builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { } }); builder.create(); builder.show(); }
From source file:com.sourcey.materiallogindemo.NotificationActivity.java
private void DialogConfirmRequest() { View dialogBoxView = View.inflate(this, R.layout.dialog_confirm_request, null); final Button btnAccept = (Button) dialogBoxView.findViewById(R.id.btnAccept); final Button btnReject = (Button) dialogBoxView.findViewById(R.id.btnReject); btnAccept.setOnClickListener(new View.OnClickListener() { @Override/*www . j a v a2 s. c om*/ public void onClick(View v) { saveConfirm(request_id, "ACCEPT"); } }); btnReject.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { saveConfirm(request_id, "REJECT"); } }); /* String url = getString(R.string.url_map)+"index.php?poinFrom="+txtStart.getText().toString().trim()+"&poinTo="+txtEnd.getText().toString().trim(); map.getSettings().setLoadsImagesAutomatically(true); map.getSettings().setJavaScriptEnabled(true); map.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY); map.loadUrl(url);*/ AlertDialog.Builder builderInOut = new AlertDialog.Builder(this); builderInOut.setTitle("?"); builderInOut.setMessage("").setView(dialogBoxView).setCancelable(false) .setPositiveButton("Close", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }).show(); }
From source file:com.pentacog.mctracker.MCServerTrackerActivity.java
/** * Presents a dialog confirming server deletion * @param position index of server to delete *///from w w w .j a v a2 s .c om private void deleteServer(final int position) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setMessage(R.string.delete_caution); builder.setPositiveButton(R.string.yes, new OnClickListener() { @SuppressWarnings("unchecked") @Override public void onClick(DialogInterface dialog, int which) { serverList.remove(position); new SaveServerListTask(getApplicationContext()).execute(serverList.getServerList()); updateListView(); } }); builder.setNegativeButton(R.string.no, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); builder.create().show(); }
From source file:com.richtodd.android.quiltdesign.app.MainActivity.java
@Override protected void onStart() { super.onStart(); try {/*from ww w . j av a2s .com*/ if (Repository.getDefaultRepository(this).isEmpty() && !hasSampleLoaderTask()) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setMessage("Would you like to add some sample blocks and quilts?") .setPositiveButton("Yes", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { SampleLoaderTask task = new SampleLoaderTask(); setSampleLoaderTask(task); task.execute(MainActivity.this); } }).setNegativeButton("No", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { // No action required. } }); Dialog dialog = builder.create(); dialog.show(); } } catch (RepositoryException e) { Handle.asRuntimeError(e); } }
From source file:com.njlabs.amrita.aid.gpms.ui.GpmsActivity.java
private void showConnectToAmritaAlert() { AlertDialog.Builder builder = new AlertDialog.Builder(baseContext); builder.setMessage("Connect to the Amrita WiFi if possible, for a reliable connection to the GPMS Server.") .setCancelable(true).setIcon(R.drawable.ic_action_info_small) .setPositiveButton("Ok. I'll connect.", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { startActivity(new Intent(android.provider.Settings.ACTION_WIFI_SETTINGS)); finish();//from ww w . j a va 2 s .c om } }).setNegativeButton("No. I won't.", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.dismiss(); initialiseGpms(); hideSoftKeyboard(); } }); AlertDialog alert = builder.create(); alert.requestWindowFeature(Window.FEATURE_NO_TITLE); if (!Identifier.isConnectedToAmrita(baseContext)) { alert.show(); } else { initialiseGpms(); } }
From source file:eu.codeplumbers.cosi.wizards.firstrun.ConnectFragment.java
private void showGiveDevicePasswordDialog() { AlertDialog.Builder alertDialog = new AlertDialog.Builder(getActivity()); alertDialog.setTitle("Register your device"); alertDialog.setMessage("Your device is already registered\n Please type your device token"); final EditText input = new EditText(getActivity()); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT); input.setLayoutParams(lp);/*w ww.j a va2 s . c o m*/ alertDialog.setView(input); alertDialog.setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { String password = input.getText().toString(); if (!password.isEmpty()) { final JSONObject permissionJson = new JSONObject(); final JSONObject desc = new JSONObject(); try { Device device = new Device(); device.setUrl(mUrl.getText().toString()); device.setLogin(mDeviceName.getText().toString()); device.setPassword(password); desc.put("description", "sync all my cozy data"); permissionJson.put("All", desc); device.setPermissions(permissionJson.toString()); device.setFirstSyncDone(false); device.setSyncCalls(false); device.setSyncContacts(false); device.setSyncFiles(false); device.setSyncNotes(false); device.save(); onRegisterSuccess(device); } catch (JSONException e) { e.printStackTrace(); } } else { input.setError("Your device token can not be empty!"); } } }); alertDialog.show(); }
From source file:edu.illinois.whereru.MainPageActivity.java
private void showRegistrationDialog() { AlertDialog.Builder builder = new AlertDialog.Builder(this); LayoutInflater factory = LayoutInflater.from(this); // inflate dialog view View view = factory.inflate(R.layout.dialog_user_registration, null); // Setting dialog message and title builder.setMessage(R.string.register_dialog_message).setTitle(R.string.register_dialog_title); // set custom view builder.setView(view);//from w w w . ja va2s . c o m // need to get the edittext from dialog layout // calling findViewById automatically searches the layout attached to this activity editText = (EditText) view.findViewById(R.id.dialog_username_text); preferenceEditor = userInfo.edit(); builder.setPositiveButton(R.string.register_button_text, new OnClickListener() { public void onClick(DialogInterface dialogs, int id) { String userName = editText.getText().toString(); // TODO need to figure out a way to define a user with unique id String deviceID = Secure.getString(getContentResolver(), Secure.ANDROID_ID); // Connect to DB and store a new user DBConnector dbConnector = new DBConnector(); dbConnector.execute(DBConnector.ADD_USER, userName, deviceID); JSONObject result = null; // Wait for the feedback from the DB try { result = dbConnector.get(); } catch (InterruptedException e) { // shouldn't be interrupted Log.e(DEBUG_TAG, "Interrupted, restarting"); } catch (ExecutionException e) { e.printStackTrace(); } boolean successful = false; String userId = null; // Parse the response returned from DB if (result != null) { successful = JSONObjectParser.getSuccess(result); userId = JSONObjectParser.getUserId(result) + ""; } if (successful) { // Store user info locally // user id returned from DB preferenceEditor.putString(PREF_USER_ID, userId); preferenceEditor.putString(PREF_USER_NAME, userName); preferenceEditor.putString(PREF_DEVICE_ID, deviceID); preferenceEditor.putBoolean(PREF_APPLICATION_STATE, false); preferenceEditor.commit(); // start main tab activity startActivity(intent); finish(); } else { // notify users of failure, let users press back button to exit. Toast.makeText(getApplicationContext(), "Failed to register, please try again later", Toast.LENGTH_SHORT).show(); } } }); builder.setNegativeButton(R.string.register_dialog_cancel, new OnClickListener() { public void onClick(DialogInterface dialog, int which) { // exit out of this activity finish(); } }); dialog = builder.create(); dialog.show(); }
From source file:com.thanu.schoolbustracker.RouteActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.menu_legalnotices: String LicenseInfo = GooglePlayServicesUtil.getOpenSourceSoftwareLicenseInfo(getApplicationContext()); AlertDialog.Builder LicenseDialog = new AlertDialog.Builder(RouteActivity.this); LicenseDialog.setTitle("Legal Notices"); LicenseDialog.setMessage(LicenseInfo); LicenseDialog.show();// ww w .ja v a2 s. c o m return true; } return super.onOptionsItemSelected(item); }
From source file:org.safegees.safegees.gui.view.MainActivity.java
public void setNoInternetAdvice(Context context) { final AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setMessage(getResources().getString(R.string.splash_advice_first_use_advice)).setCancelable(false) .setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { Intent i = getBaseContext().getPackageManager() .getLaunchIntentForPackage(getBaseContext().getPackageName()); i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(i);/*ww w . j a v a 2 s. c om*/ //finish(); } }); AlertDialog alert = builder.create(); alert.show(); }