List of usage examples for android.app AlertDialog.Builder setIcon
public void setIcon(Drawable icon)
From source file:com.svpino.longhorn.fragments.StockListFragment.java
private void showDeleteWarningDialog(Integer position) { if (this.removeSelectedStocksDialog == null || !this.removeSelectedStocksDialog.isShowing()) { if (position == null) { if (this.selectedTiles.size() == 1) { position = ((StockTileViewHolder) this.tiles.get(this.selectedTiles.get(0)).getTag()) .getPosition();/*from w w w. ja v a 2s . c o m*/ } } final Stock stock = position != null ? ((StockTileViewHolder) this.tiles.get(position).getTag()).getStock() : null; AlertDialog.Builder removeSelectedStocksDialogBuilder = new AlertDialog.Builder(getActivity()); String message = this.callback.getRemoveWarningDialogMessage(stock); View view = getLayoutInflater().inflate(R.layout.dialog_message, null); TextView textView = (TextView) view.findViewById(R.id.textView); textView.setText(message); removeSelectedStocksDialogBuilder.setIcon(R.drawable.ic_warning) .setTitle(this.callback.getRemoveWarningDialogTitle(stock)).setView(view) .setPositiveButton(R.string.label_remove, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { removeSelectedStocks(stock); } }).setNegativeButton(R.string.label_cancel, null); this.removeSelectedStocksDialog = removeSelectedStocksDialogBuilder.create(); this.removeSelectedStocksDialog.show(); } }
From source file:com.sssemil.sonyirremote.ir.ir.java
public void alert(String msg) { AlertDialog.Builder errorD = new AlertDialog.Builder(this); errorD.setTitle(getString(R.string.error)); errorD.setMessage(msg);//from w w w . j av a2 s . com errorD.setIcon(android.R.drawable.ic_dialog_alert); errorD.setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { } }); errorD.show(); }
From source file:com.nexes.manager.EventHandler.java
/** * This private method is used to display options the user can select when * the tool box button is pressed. The WIFI option is commented out as it * doesn't seem to fit with the overall idea of the application. However to * display it, just uncomment the below code and the code in the * AndroidManifest.xml file.// w w w . j a va 2 s .c o m */ private void display_dialog(int type) { AlertDialog.Builder builder; AlertDialog dialog; switch (type) { case MANAGE_DIALOG: // un-comment WIFI Info here and in the manifest file // to display WIFI info. Also uncomment and change case number below CharSequence[] options = { "Process Info", /* "Wifi Info", */ "Application backup" }; builder = new AlertDialog.Builder(mContext); builder.setTitle("Tool Box"); builder.setIcon(R.drawable.toolbox); builder.setItems(options, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int index) { Intent i; switch (index) { case 0: i = new Intent(mContext, ProcessManager.class); mContext.startActivity(i); break; /* * case 1: i = new Intent(context, WirelessManager.class); * context.startActivity(i); break; */ case 1: i = new Intent(mContext, ApplicationBackup.class); mContext.startActivity(i); break; } } }); dialog = builder.create(); dialog.show(); break; } }
From source file:com.sssemil.sonyirremote.ir.ir.java
public boolean prepBISpinner() { try {/* w ww. ja v a2s .co m*/ spinner = (Spinner) findViewById(R.id.spinner); item = spinner.getSelectedItem().toString(); result = true; } catch (NullPointerException ex) { AlertDialog.Builder adb = new AlertDialog.Builder(this); adb.setTitle(getString(R.string.error)); adb.setMessage(getString(R.string.you_need_to_select)); adb.setIcon(android.R.drawable.ic_dialog_alert); adb.setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { result = false; } }); adb.show(); } return result; }
From source file:github.popeen.dsub.activity.SubsonicActivity.java
private void showOfflineSyncDialog(final int scrobbleCount, final int starsCount) { String syncDefault = Util.getSyncDefault(this); if (syncDefault != null) { if ("sync".equals(syncDefault)) { syncOffline(scrobbleCount, starsCount); return; } else if ("delete".equals(syncDefault)) { deleteOffline();/*from w ww .ja v a 2s . c o m*/ return; } } View checkBoxView = this.getLayoutInflater().inflate(R.layout.sync_dialog, null); final CheckBox checkBox = (CheckBox) checkBoxView.findViewById(R.id.sync_default); AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setIcon(android.R.drawable.ic_dialog_info).setTitle(R.string.offline_sync_dialog_title) .setMessage(this.getResources().getString(R.string.offline_sync_dialog_message, scrobbleCount, starsCount)) .setView(checkBoxView).setPositiveButton(R.string.common_ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { if (checkBox.isChecked()) { Util.setSyncDefault(SubsonicActivity.this, "sync"); } syncOffline(scrobbleCount, starsCount); } }).setNeutralButton(R.string.common_cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { dialogInterface.dismiss(); } }).setNegativeButton(R.string.common_delete, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { if (checkBox.isChecked()) { Util.setSyncDefault(SubsonicActivity.this, "delete"); } deleteOffline(); } }); builder.create().show(); }
From source file:com.sssemil.sonyirremote.ir.ir.java
public void startLearning(final String filename) { File to = new File(filename); if (to.exists()) { AlertDialog.Builder adb1 = new AlertDialog.Builder(this); adb1.setTitle(getString(R.string.warning)); adb1.setMessage(getString(R.string.alredy_exists)); adb1.setIcon(android.R.drawable.ic_dialog_alert); adb1.setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { learnAction(filename);/* ww w .jav a 2s. c o m*/ } }); adb1.setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { } }); adb1.show(); } else { learnAction(filename); } }
From source file:com.sssemil.sonyirremote.ir.ir.java
public void onAddDeviceClick(View paramView) { try {// ww w. j a v a 2 s. c om itemN = ((EditText) findViewById(R.id.editText)); brandN = ((EditText) findViewById(R.id.editText2)); if (itemN.getText() != null || brandN.getText() != null) { String all = brandN.getText().toString() + "-" + itemN.getText().toString(); if (!all.equals("-")) { File localFile2 = new File( irpath + brandN.getText().toString() + "-" + itemN.getText().toString()); if (!localFile2.isDirectory()) { localFile2.mkdirs(); } prepItemBrandArray(); } } else { throw new NullPointerException(); } } catch (NullPointerException ex) { AlertDialog.Builder adb = new AlertDialog.Builder(this); adb.setTitle(getString(R.string.error)); adb.setMessage(getString(R.string.you_need_to_select)); adb.setIcon(android.R.drawable.ic_dialog_alert); adb.setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { } }); adb.show(); } }
From source file:com.sssemil.sonyirremote.ir.ir.java
public void onRemoveClick(View view) { try {/*from w w w. j a v a2 s .c o m*/ Toast.makeText(this, item, Toast.LENGTH_SHORT).show(); String[] remove = { "rm", "-rf", irpath + item }; try { Process p = Runtime.getRuntime().exec(remove); Log.i("rm", "Waiting... " + irpath + item); p.waitFor(); Log.i("rm", "Done! " + irpath + item); } catch (Exception e) { Log.e("rm", "Failed! " + irpath + item); e.printStackTrace(); } spinner = ((Spinner) findViewById(R.id.spinner)); localArrayList1 = new ArrayList(); localArrayList1.remove(item); ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, localArrayList1); dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(dataAdapter); AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(getString(R.string.done)); builder.setMessage(getString(R.string.done_removing) + " " + item + " " + getString(R.string.files)); builder.setPositiveButton("OK", null); AlertDialog dialog = builder.show(); TextView messageView = (TextView) dialog.findViewById(android.R.id.message); messageView.setGravity(Gravity.CENTER); } catch (NullPointerException ex) { ex.printStackTrace(); AlertDialog.Builder adb = new AlertDialog.Builder(this); adb.setTitle(getString(R.string.error)); adb.setMessage(getString(R.string.you_need_to_select)); adb.setIcon(android.R.drawable.ic_dialog_alert); adb.setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { } }); adb.show(); } }
From source file:net.evecom.android.PublicOpinionLookActivity.java
/** * // www. ja v a2 s. c o m * * @param errorMsg */ private void DialogToast(String errorMsg) { AlertDialog.Builder builder1 = new AlertDialog.Builder(PublicOpinionLookActivity.this); builder1.setTitle(""); builder1.setIcon(R.drawable.qq_dialog_default_icon);// builder1.setMessage("" + errorMsg); builder1.setPositiveButton("", new DialogInterface.OnClickListener() { // @Override public void onClick(DialogInterface dialog, int which) { } }); builder1.show(); }
From source file:com.sssemil.sonyirremote.ir.ir.java
private void sendKeyBool(final String filename) { File to = new File(filename); spinner = ((Spinner) findViewById(R.id.spinner)); if (spinner.getSelectedItem() != null) { if (!to.exists()) { AlertDialog.Builder adb1 = new AlertDialog.Builder(this); adb1.setTitle(getString(R.string.warning)); adb1.setMessage(getString(R.string.not_exists)); adb1.setIcon(android.R.drawable.ic_dialog_alert); adb1.setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { startLearning(filename); }/*from www. java 2s .c o m*/ }); adb1.setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { } }); adb1.show(); } else { sendAction(filename); } } else { AlertDialog.Builder adb = new AlertDialog.Builder(this); adb.setTitle(getString(R.string.error)); adb.setMessage(getString(R.string.you_need_to_select)); adb.setIcon(android.R.drawable.ic_dialog_alert); adb.setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { } }); adb.show(); } }