Example usage for android.app AlertDialog.Builder setIcon

List of usage examples for android.app AlertDialog.Builder setIcon

Introduction

In this page you can find the example usage for android.app AlertDialog.Builder setIcon.

Prototype

public void setIcon(Drawable icon) 

Source Link

Usage

From source file:com.dogar.geodesic.map.MainActivity.java

private void openDeleteMarkersChooseDialog() {
    AlertDialog.Builder alert = new AlertDialog.Builder(this);
    alert.setTitle("Deleting markers");
    alert.setIcon(R.drawable.ic_tool);
    alert.setMessage("Do you really want to delete all markers?");
    alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() {

        @Override//from  w ww  .  j a  v  a  2 s  .  com
        public void onClick(DialogInterface arg0, int arg1) {
            ContentValues newValues = new ContentValues();
            newValues.put(PointsContract.Entry.COLUMN_NAME_DELETE, 1);
            getContentResolver().update(PointsContract.Entry.CONTENT_URI, newValues, SyncAdapter.ACCOUNT_FILTER,
                    new String[] { accountName });
            GMFragment.clearMarkersAndDrawNew();
        }
    });
    alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int whichButton) {
        }
    });
    alert.show();
}

From source file:com.securecomcode.voice.ui.UpgradeCallDialogFragment.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {

    final AlertDialog.Builder builder;
    if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.HONEYCOMB) {
        builder = new AlertDialog.Builder(
                new ContextThemeWrapper(getActivity(), R.style.RedPhone_Light_Dialog));
    } else {//from   w  w  w.jav a  2s . co  m
        builder = new AlertDialog.Builder(getActivity(), R.style.RedPhone_Light_Dialog);
    }

    builder.setIcon(R.drawable.red_call);

    final String upgradeString = getActivity().getResources()
            .getString(R.string.RedPhoneChooser_upgrade_to_redphone);
    SpannableStringBuilder titleBuilder = new SpannableStringBuilder(upgradeString);
    titleBuilder.setSpan(new AbsoluteSizeSpan(20, true), 0, upgradeString.length(),
            Spanned.SPAN_INCLUSIVE_INCLUSIVE);
    builder.setTitle(titleBuilder);

    builder.setMessage(
            R.string.RedPhoneChooser_this_contact_also_uses_redphone_would_you_like_to_upgrade_to_a_secure_call);

    builder.setPositiveButton(R.string.RedPhoneChooser_secure_call, new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            Intent intent = new Intent(getActivity(), RedPhoneService.class);
            intent.setAction(RedPhoneService.ACTION_OUTGOING_CALL);
            intent.putExtra(Constants.REMOTE_NUMBER, number);
            getActivity().startService(intent);

            Intent activityIntent = new Intent();
            activityIntent.setClass(getActivity(), RedPhone.class);
            activityIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            startActivity(activityIntent);

            getActivity().finish();
        }
    });

    builder.setNegativeButton(R.string.RedPhoneChooser_insecure_call, new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            CallChooserCache.getInstance().addInsecureChoice(number);

            Intent intent = new Intent("android.intent.action.CALL",
                    Uri.fromParts("tel", number + CallListener.IGNORE_SUFFIX, null));
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            startActivity(intent);
            getActivity().finish();
        }
    });

    AlertDialog alert = builder.create();

    alert.setOnShowListener(new DialogInterface.OnShowListener() {
        @Override
        public void onShow(DialogInterface dialog) {
            ((AlertDialog) dialog).setOnCancelListener(new DialogInterface.OnCancelListener() {
                @Override
                public void onCancel(DialogInterface dialogInterface) {
                    getActivity().finish();
                }
            });

            ((AlertDialog) dialog).setOnDismissListener(new DialogInterface.OnDismissListener() {
                @Override
                public void onDismiss(DialogInterface dialogInterface) {
                    getActivity().finish();
                }
            });
            Button positiveButton = ((AlertDialog) dialog).getButton(AlertDialog.BUTTON_POSITIVE);

            Button negativeButton = ((AlertDialog) dialog).getButton(AlertDialog.BUTTON_NEGATIVE);
        }
    });

    return alert;
}

From source file:com.linkbubble.util.YouTubeEmbedHelper.java

AlertDialog getEmbedResultsDialog() {
    if (mEmbedInfo.size() > 0) {
        ListView listView = new ListView(mContext);
        listView.setAdapter(new EmbedItemAdapter());

        AlertDialog.Builder builder = new AlertDialog.Builder(mContext);
        builder.setView(listView);/*  w  w  w  .ja v  a2 s.  co  m*/
        builder.setIcon(mYouTubeResolveInfo.loadIcon(mContext.getPackageManager()));
        builder.setTitle(R.string.title_youtube_embed_to_load);

        final AlertDialog alertDialog = builder.create();
        alertDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);

        listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                EmbedInfo embedInfo = (EmbedInfo) view.getTag();
                if (embedInfo != null) {
                    loadYouTubeVideo(embedInfo.mId);
                }
                alertDialog.dismiss();
            }
        });

        return alertDialog;
    } else {
        final AlertDialog alertDialog = new AlertDialog.Builder(mContext).create();
        alertDialog.setTitle(R.string.youtube_embed_error_title);
        alertDialog.setMessage(mContext.getString(R.string.youtube_embed_error_summary));
        alertDialog.setButton(AlertDialog.BUTTON_POSITIVE,
                mContext.getResources().getString(R.string.action_ok), new DialogInterface.OnClickListener() {

                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        alertDialog.dismiss();
                    }

                });
        alertDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
        return alertDialog;
    }
}

From source file:com.cl.slack.gesture.GestureBuilderActivity.java

private Dialog createRenameDialog() {
    final View layout = View.inflate(this, R.layout.dialog_rename, null);
    mInput = (EditText) layout.findViewById(R.id.name);
    ((TextView) layout.findViewById(R.id.label)).setText(R.string.gestures_rename_label);

    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setIcon(0);
    builder.setTitle(getString(R.string.gestures_rename_title));
    builder.setCancelable(true);/*  w  w w .  ja va 2 s .com*/
    builder.setOnCancelListener(new Dialog.OnCancelListener() {
        public void onCancel(DialogInterface dialog) {
            cleanupRenameDialog();
        }
    });
    builder.setNegativeButton(getString(R.string.cancel_action), new Dialog.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            cleanupRenameDialog();
        }
    });
    //        builder.setNeutralButton(getString(R.string.cancel_action),
    //                new Dialog.OnClickListener() {
    //                    public void onClick(DialogInterface dialog, int which) {
    //                        cleanupRenameDialog();
    //                    }
    //                }
    //        );
    builder.setPositiveButton(getString(R.string.rename_action), new Dialog.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            changeGestureName();
        }
    });
    builder.setView(layout);
    return builder.create();
}

From source file:br.liveo.ndrawer.ui.fragment.MainFragment32.java

private void failDialog() {
    AlertDialog.Builder alertDialog = new AlertDialog.Builder(getActivity());
    alertDialog.setTitle(" ? ");
    alertDialog.setMessage("? ?? ");
    alertDialog.setIcon(R.drawable.fail);

    alertDialog.setPositiveButton("", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            dialog.cancel();//from w w w .  j  a  v a 2s.  c  o  m
        }
    });

    alertDialog.show();
}

From source file:com.nuvolect.securesuite.data.SqlSyncTest.java

public void pingPongConfirmDiag(final Activity act) {

    m_act = act;//from   w ww  .j av  a  2  s  . co m

    if (!WebUtil.companionServerAssigned()) {
        Toast.makeText(act, "Configure companion device for test to operate", Toast.LENGTH_LONG).show();
        return;
    }

    String title = "Pyramid comm test with companion device";
    String message = "This is a non-destructive network performance test. "
            + "Payload size is incrementally increased.";

    AlertDialog.Builder builder = new AlertDialog.Builder(act);
    builder.setTitle(title);
    builder.setMessage(Html.fromHtml(message));
    builder.setIcon(CConst.SMALL_ICON);
    builder.setCancelable(true);

    builder.setPositiveButton("Start test", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int whichButton) {

            setProgressCallback(m_act, pingPongCallbacks);
            pingPongProgress(act);
            SqlSyncTest.getInstance().init();// Small amount of init on UI thread
            WorkerCommand.quePingTest(m_act);// Heavy lifting on non-UI thread
        }
    });
    builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int whichButton) {

            dialog_alert.cancel();
        }
    });
    dialog_alert = builder.create();
    dialog_alert.show();

    // Activate the HTML
    TextView tv = ((TextView) dialog_alert.findViewById(android.R.id.message));
    tv.setMovementMethod(LinkMovementMethod.getInstance());
}

From source file:net.evecom.android.log.DailyLogAddActivity.java

/**
 * /* ww w.ja v  a 2  s. c  o m*/
 * 
 * @param errorMsg
 */
private void DialogToast(String errorMsg) {
    AlertDialog.Builder builder1 = new AlertDialog.Builder(DailyLogAddActivity.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:br.liveo.ndrawer.ui.fragment.MainFragment32.java

private void limitDialog() {
    AlertDialog.Builder alertDialog = new AlertDialog.Builder(getActivity());
    alertDialog.setTitle(" ? ");
    alertDialog.setMessage(" ?  ? 6");
    alertDialog.setIcon(R.drawable.fail);

    alertDialog.setPositiveButton("", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            dialog.cancel();//  w w  w .ja v a  2 s .  c o m
        }
    });

    alertDialog.show();
}

From source file:jp.co.rakuten.rakutenvideoplayer.base.BaseActivity.java

/**
 * Show dialog error// w  w  w .  ja  v  a2 s .co m
 * @param errStr
 */
public void showDialogInformation(String errStr) {
    AlertDialog.Builder adb = new AlertDialog.Builder(this);
    adb.setIcon(R.drawable.icon);
    adb.setTitle(R.string.str_ErrPlay_Title);
    adb.setMessage(errStr);
    adb.setPositiveButton(R.string.str_OK, new OnClickListener() {
        public void onClick(DialogInterface a0, int a1) {
            return;
        }
    });
    AlertDialog ad = adb.create();
    ad.show();
}

From source file:com.sunmeng.educationaladministration.animateview.GoogleCardsActivity.java

@Override
public void onDismiss(ListView listView, int[] reverseSortedPositions) {
    for (final int position : reverseSortedPositions) {

        //Toast.makeText(GoogleCardsActivity.this, "position=" + position, Toast.LENGTH_LONG).show();
        ///*from   w w  w  .  ja v a2s  .co m*/
        AlertDialog.Builder b = new AlertDialog.Builder(GoogleCardsActivity.this);//this  ?Activity
        //   ??
        b.setIcon(android.R.drawable.ic_dialog_alert);
        //
        b.setTitle("???");
        b.setMessage("?");

        //
        b.setPositiveButton("", new DialogInterface.OnClickListener() {

            @Override
            public void onClick(DialogInterface dialog, int which) {
                Map<String, Object> map = mGoogleCardsAdapter.getItem(position);
                Toast.makeText(GoogleCardsActivity.this, "aid=" + map.get("aid").toString(),
                        Toast.LENGTH_LONG).show();
                RequestParams params = new RequestParams();
                params.addBodyParameter("activitiesdeleted", map.get("aid").toString());
                httpUtils.send(HttpRequest.HttpMethod.POST, HttpClientUtil.HTTP_URL + "ActivitiesDeleteServlet",
                        params, new RequestCallBack() {
                            @Override
                            public void onFailure(HttpException error, String message) {
                            }

                            @Override
                            public void onSuccess(ResponseInfo responseInfo) {
                                String resultJson = responseInfo.result.toString();
                                //Log.i("ct", "="+resultJson);
                                mGoogleCardsAdapter.remove(mGoogleCardsAdapter.getItem(position));

                            }
                        });

            }

        });

        b.setNegativeButton("?", null);
        b.show();//
    }
}