List of usage examples for android.app AlertDialog.Builder setIcon
public void setIcon(Drawable icon)
From source file:com.andybotting.tubechaser.activity.Home.java
/** * Show about dialog window//w ww .ja va2 s . com */ public void showAbout() { // Get the package name String heading = getResources().getText(R.string.app_name) + "\n"; try { PackageInfo pi = getPackageManager().getPackageInfo(getPackageName(), 0); heading += "v" + pi.versionName + "\n\n"; } catch (NameNotFoundException e) { e.printStackTrace(); } // Build alert dialog AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this); dialogBuilder.setTitle(heading); View aboutView = getLayoutInflater().inflate(R.layout.dialog_about, null); dialogBuilder.setView(aboutView); dialogBuilder.setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { // Set first launch flag in DB mPreferenceHelper.setFirstLaunchThisVersion(); } }); dialogBuilder.setCancelable(false); dialogBuilder.setIcon(R.drawable.appicon); dialogBuilder.show(); }
From source file:org.rebo.app.TileMap.java
@Override protected Dialog onCreateDialog(int id) { AlertDialog.Builder builder = new AlertDialog.Builder(this); if (id == DIALOG_ENTER_COORDINATES) { if (mLocationDialog == null) mLocationDialog = new LocationDialog(); return mLocationDialog.createDialog(this); } else if (id == DIALOG_LOCATION_PROVIDER_DISABLED) { builder.setIcon(android.R.drawable.ic_menu_info_details); builder.setTitle(R.string.error); builder.setMessage(R.string.no_location_provider_available); builder.setPositiveButton(R.string.ok, null); return builder.create(); } else {//w w w . j a v a 2 s. c om // no dialog will be created return null; } }
From source file:br.liveo.ndrawer.ui.fragment.MainFragment31.java
private void successDialog(int i) { AlertDialog.Builder alertDialog = new AlertDialog.Builder(getActivity()); if (i == 2 || i == 3) { alertDialog.setTitle(" ? "); alertDialog.setMessage("? ? ??"); } else if (i == 1) { alertDialog.setTitle(" "); alertDialog.setMessage("? ? ?"); } else if (i == 4) { alertDialog.setTitle(" "); alertDialog.setMessage("? ? ?"); }/*from ww w .j a v a 2 s .c om*/ alertDialog.setIcon(R.drawable.ic_dialog_alert); alertDialog.setPositiveButton("", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // Write your code here to invoke YES event dialog.cancel(); getMyBeaconList(); } }); alertDialog.show(); }
From source file:cm.aptoide.pt.ManageRepos.java
private void askAddDefaultRepo() { final String uri = Constants.APPS_REPO; AlertDialog.Builder defaultDialog = new AlertDialog.Builder(theme); defaultDialog.setTitle(getString(R.string.attention)); defaultDialog.setIcon(R.drawable.ic_menu_info_details); defaultDialog.setMessage(getString(R.string.add_default_repo_confirm) + uri); defaultDialog.setPositiveButton(getText(R.string.yes), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { addDisplayRepo(new ViewRepository(uri)); initReposList();//ww w .j av a2 s . c om return; } }); defaultDialog.setNegativeButton(getText(R.string.no), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { initReposList(); return; } }); defaultDialog.show(); }
From source file:org.thoughtland.xlocation.ActivityShare.java
@SuppressLint("InflateParams") public static boolean registerDevice(final ActivityBase context) { int userId = Util.getUserId(Process.myUid()); if (Util.hasProLicense(context) == null && !PrivacyManager.getSettingBool(userId, PrivacyManager.cSettingRegistered, false)) { // Get accounts String email = null;/* w ww .jav a 2 s . c o m*/ for (Account account : AccountManager.get(context).getAccounts()) if ("com.google".equals(account.type)) { email = account.name; break; } LayoutInflater LayoutInflater = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); View view = LayoutInflater.inflate(R.layout.register, null); final EditText input = (EditText) view.findViewById(R.id.etEmail); if (email != null) input.setText(email); // Build dialog AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(context); alertDialogBuilder.setTitle(R.string.msg_register); alertDialogBuilder.setIcon(context.getThemed(R.attr.icon_launcher)); alertDialogBuilder.setView(view); alertDialogBuilder.setPositiveButton(context.getString(android.R.string.ok), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { String email = input.getText().toString(); if (Patterns.EMAIL_ADDRESS.matcher(email).matches()) new RegisterTask(context).executeOnExecutor(mExecutor, email); } }); alertDialogBuilder.setNegativeButton(context.getString(android.R.string.cancel), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // Do nothing } }); // Show dialog AlertDialog alertDialog = alertDialogBuilder.create(); alertDialog.show(); return false; } return true; }
From source file:com.songcode.materialnotes.ui.NoteEditActivity.java
private void deleteNote() { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(getString(R.string.alert_title_delete)); builder.setIcon(android.R.drawable.ic_dialog_alert); builder.setMessage(getString(R.string.alert_message_delete_note)); builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { deleteCurrentNote();/* ww w . ja v a 2 s. c o m*/ finish(); } }); builder.setNegativeButton(android.R.string.cancel, null); builder.show(); }
From source file:cm.aptoide.pt.ManageRepos.java
@Override public boolean onContextItemSelected(MenuItem item) { AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo(); TextView selectedView = (TextView) ((View) (info.targetView)).findViewById(R.id.uri); final String repo_selected = selectedView.getText().toString(); popupOptions popupOption = popupOptions.values()[item.getItemId()]; switch (popupOption) { case EDIT_REPO: validateRepo(repo_selected, true); refreshReposList();// w ww . java 2 s .c o m break; case REMOVE_REPO: AlertDialog.Builder builder = new AlertDialog.Builder(theme); builder.setTitle(getString(R.string.remove_repo)); builder.setIcon(R.drawable.ic_menu_close_clear_cancel); builder.setMessage(getString(R.string.remove_repo_confirm) + " " + repo_selected + " ?"); builder.setPositiveButton(getString(R.string.yes), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { removeDisplayRepo(repo_selected.hashCode()); alert3.dismiss(); refreshReposList(); } }); builder.setNegativeButton(getString(R.string.no), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { alert3.dismiss(); return; } }); alert3 = builder.create(); alert3.show(); break; default: break; } return super.onContextItemSelected(item); }
From source file:cm.aptoide.pt.ManageRepos.java
private void receiveMyappRepos() { try {// ww w.j a v a 2s .c o m final ViewDisplayListRepos myappRepos = serviceDataCaller.callGetWaitingMyappRepos(); //TODO checkServerConnection final CharSequence[] reposArray = new CharSequence[myappRepos.getList().size()]; for (int i = 0; i < myappRepos.getList().size(); i++) { reposArray[i] = (String) myappRepos.getList().get(i).get(Constants.KEY_REPO_URI); } final ArrayList<String> addList = new ArrayList<String>(); AlertDialog.Builder builder = new AlertDialog.Builder(theme); builder.setTitle(getString(R.string.add_repo_choose)); builder.setIcon(R.drawable.ic_menu_add); builder.setMultiChoiceItems(reposArray, null, new DialogInterface.OnMultiChoiceClickListener() { public void onClick(DialogInterface dialog, int whichButton, boolean isChecked) { if (isChecked) { addList.add(reposArray[whichButton].toString()); } else { addList.remove(reposArray[whichButton].toString()); } } }); builder.setPositiveButton(getString(R.string.add), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { for (String repoUri : addList) { addDisplayRepo(new ViewRepository(repoUri)); } alert.dismiss(); handlingMyappRepos = false; refreshReposList(); } }); builder.setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { alert.dismiss(); handlingMyappRepos = false; finish(); } }); alert = builder.create(); alert.show(); } catch (RemoteException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
From source file:org.onebusaway.android.ui.HomeActivity.java
@SuppressWarnings("deprecation") private Dialog createWhatsNewDialog() { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(R.string.main_help_whatsnew_title); builder.setIcon(R.mipmap.ic_launcher); builder.setMessage(mWhatsNewMessage); builder.setNeutralButton(R.string.main_help_close, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dismissDialog(WHATSNEW_DIALOG); }/*w w w. j a va 2 s .c o m*/ }); return builder.create(); }
From source file:ir.actfun.toofan.activities.MainActivity.java
private void aboutDialog() { AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.setTitle("Toofan"); alert.setIcon(R.mipmap.ic_launcher); final WebView webView = new WebView(this); String about = "<p>A lightweight, Materialized and Precise weather app.</p>" + "<p>Developed by <a href='mailto:aligholami7596@gmail.com'>Ali Gholami</a></p>" + "Graphical Design and Support by <a href='http://www.mtabatabaei.com/'>Mohamad Tabatabaei</a></p>" + "co-developers: <a href='mailto:khajavi_mohamad@yahoo.com'>Mohamad Khajavi</a></p> <a href='mailto:faezehsalmanfar@gmail.com'>Faezeh Salmanfar</a></p>" + "<p>Data provided by <a href='http://openweathermap.org/'>OpenWeatherMap</a>, under the <a href='http://creativecommons.org/licenses/by-sa/2.0/'>Creative Commons license</a>" + "<p>Icons are <a href='https://erikflowers.github.io/weather-icons/'>Weather Icons</a>, by <a href='http://www.twitter.com/artill'>Lukas Bischoff</a> and <a href='http://www.twitter.com/Erik_UX'>Erik Flowers</a>, under the <a href='http://scripts.sil.org/OFL'>SIL OFL 1.1</a> licence."; if (darkTheme) { // Style text color for dark theme about = "<style media=\"screen\" type=\"text/css\">" + "body {\n" + " color:white;\n" + "}\n" + "a:link {color:cyan}\n" + "</style>" + about; }/*from www .j a va2 s .co m*/ webView.setBackgroundColor(Color.TRANSPARENT); webView.loadData(about, "text/html", "UTF-8"); alert.setView(webView, 32, 0, 32, 0); alert.setPositiveButton(R.string.dialog_ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { } }); alert.show(); }