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.linkbubble.util.YouTubeEmbedHelper.java

private AlertDialog getMultipleEmbedsDialog() {
    if (embedInfoMatchesIds()) {
        return getEmbedResultsDialog();
    } else {// w  ww. j a v  a2 s .c om
        AlertDialog.Builder builder = new AlertDialog.Builder(mContext);

        LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        View view = inflater.inflate(R.layout.view_loading, null);

        TextView textView = (TextView) view.findViewById(R.id.loading_text);
        textView.setText(R.string.loading_youtube_embed_info);

        builder.setView(view);
        builder.setIcon(0);

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

        if (mCurrentDownloadTask != null) {
            synchronized (mCurrentDownloadTask) {
                if (mCurrentDownloadTask != null) {
                    mCurrentDownloadTask.cancel(true);
                }
                mCurrentDownloadTask = new DownloadYouTubeEmbedInfoTask(true, alertDialog);
                mCurrentDownloadTask.execute(null, null, null);
            }
        } else {
            mCurrentDownloadTask = new DownloadYouTubeEmbedInfoTask(true, alertDialog);
            mCurrentDownloadTask.execute(null, null, null);
        }

        return alertDialog;
    }
}

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

public void deleteBeacon(int position) {
    final String beaconmac = mMyDeviceAdapter.getDeviceList().get(position).getBdAddr();

    AlertDialog.Builder alertDialog = new AlertDialog.Builder(getActivity());
    alertDialog.setTitle("  ?");
    alertDialog.setMessage("? ? ?");
    alertDialog.setIcon(R.drawable.alert);

    alertDialog.setPositiveButton("", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            updateEvent("BEACON_DELETE");
            DeleteBeacon deleteBeacon = new DeleteBeacon();
            deleteBeacon.execute("http://125.131.73.198:3000/beconDelete", beaconmac);
        }//from  w w w .j a  v a 2s  .c o  m
    });

    alertDialog.setNegativeButton("", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            dialog.cancel();
        }
    });
    alertDialog.show();
}

From source file:net.evecom.android.web.Web3Activity.java

/**
 * //from   ww w . j a v  a 2s .co  m
 * 
 * @param v
 */
public void message_post_web_tomain(View v) {
    AlertDialog.Builder builder1 = new AlertDialog.Builder(Web3Activity.this);
    builder1.setTitle("");
    builder1.setIcon(R.drawable.qq_dialog_default_icon);// 
    builder1.setMessage("");
    builder1.setPositiveButton("", new DialogInterface.OnClickListener() {
        // @Override
        public void onClick(DialogInterface dialog, int which) {
            finish();
        }
    });
    builder1.setNegativeButton("", new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {

        }
    });
    builder1.show();
}

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

private void updateUseBeacon(int usingPosition, int position) {
    final String usingBeaconmac = mMyDeviceAdapter.getDeviceList().get(usingPosition).getBdAddr();
    final String beaconmac = mMyDeviceAdapter.getDeviceList().get(position).getBdAddr();

    AlertDialog.Builder alertDialog = new AlertDialog.Builder(getActivity());
    alertDialog.setTitle("  ?");
    alertDialog.setMessage("? ? ?");
    alertDialog.setIcon(R.drawable.alert);

    alertDialog.setPositiveButton("", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {

            updateEvent("BEACON_USE");
            UpdateUseBeacon updateUseBeacon = new UpdateUseBeacon();
            updateUseBeacon.execute("http://125.131.73.198:3000/beaconUseUpdate", usingBeaconmac, beaconmac);
        }//from w  w  w  . ja  v a  2  s.c  o  m
    });

    alertDialog.setNegativeButton("", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            dialog.cancel();
        }
    });

    alertDialog.show();

}

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

public void useBeacon(int position) {
    final String beaconmac = mMyDeviceAdapter.getDeviceList().get(position).getBdAddr();

    AlertDialog.Builder alertDialog = new AlertDialog.Builder(getActivity());
    alertDialog.setTitle("  ?");
    alertDialog.setMessage("? ? ?");
    alertDialog.setIcon(R.drawable.alert);

    alertDialog.setPositiveButton("", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            updateEvent("BEACON_USE");
            UseBeacon useBeacon = new UseBeacon();
            useBeacon.execute("http://125.131.73.198:3000/beaconUse", beaconmac);

        }//from   w  ww . j av a 2s .  c o m
    });

    // Setting Negative "NO" Button
    alertDialog.setNegativeButton("", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            // Write your code here to invoke NO event
            dialog.cancel();
        }
    });

    // Showing Alert Message
    alertDialog.show();
}

From source file:com.money.manager.ex.fragment.AllDataFragment.java

/**
 * @param transId primary key of transation
 *//*w w  w  .j a  v a2s  .co m*/
private void showDialogDeleteCheckingAccount(final int[] transId) {
    // create alert dialog and set title and message
    AlertDialog.Builder alertDialog = new AlertDialog.Builder(getActivity());

    alertDialog.setTitle(R.string.delete_transaction);
    alertDialog.setMessage(getResources().getQuantityString(R.plurals.plurals_delete_transactions,
            transId.length, transId.length));
    alertDialog.setIcon(R.drawable.ic_action_warning_light);

    // set listener button positive
    alertDialog.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            for (int i = 0; i < transId.length; i++) {
                TableCheckingAccount trans = new TableCheckingAccount();
                if (getActivity().getContentResolver().delete(trans.getUri(),
                        TableCheckingAccount.TRANSID + "=?",
                        new String[] { Integer.toString(transId[i]) }) == 0) {
                    Toast.makeText(getActivity(), R.string.db_delete_failed, Toast.LENGTH_SHORT).show();
                    return;
                }
            }
            // restart loader
            startLoaderData();
        }
    });
    // set listener negative button
    alertDialog.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            // close dialog
            dialog.cancel();
        }
    });

    alertDialog.create();
    alertDialog.show();
}

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

private void stopUseBeacon(int position) {
    final String beaconmac = mMyDeviceAdapter.getDeviceList().get(position).getBdAddr();

    AlertDialog.Builder alertDialog = new AlertDialog.Builder(getActivity());
    alertDialog.setTitle("   ?");
    alertDialog.setMessage("? ?   ?");
    alertDialog.setIcon(R.drawable.alert);

    alertDialog.setPositiveButton("", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            updateEvent("BEACON_STOP");
            StopUseBeacon stopUseBeacon = new StopUseBeacon();
            stopUseBeacon.execute("http://125.131.73.198:3000/beaconStop", beaconmac);
        }/*from   w w w  .  j  a va  2 s.co m*/
    });

    alertDialog.setNegativeButton("", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            dialog.cancel();
        }
    });
    alertDialog.show();
}

From source file:net.evecom.android.web.Web2Activity.java

/**
 * /*w ww . jav  a  2  s  .  c  o  m*/
 * 
 * @param v
 */
public void message_post_web_tomain(View v) {
    AlertDialog.Builder builder1 = new AlertDialog.Builder(Web2Activity.this);
    builder1.setTitle("");
    builder1.setIcon(R.drawable.qq_dialog_default_icon);// 
    builder1.setMessage("");
    builder1.setPositiveButton("", new DialogInterface.OnClickListener() {
        // @Override
        public void onClick(DialogInterface dialog, int which) {
            finish();
        }
    });
    builder1.setNegativeButton("", new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {

        }
    });
    builder1.show();
}

From source file:br.com.GUI.avaliacoes.AvaliarPerimetria.java

public void tirarFoto() {

     AlertDialog.Builder alertDialog = new AlertDialog.Builder(getActivity());
     alertDialog.setTitle("Selecione o mtodo");
     alertDialog.setMessage("Deseja usar qual aplicativo para importar sua foto?");
     alertDialog.setIcon(R.drawable.profile);
     alertDialog.setPositiveButton("Camera", new DialogInterface.OnClickListener() {
         public void onClick(DialogInterface dialog, int which) {
             usarCamera();/*from  w  w  w . ja v  a 2s  .c o  m*/
         }
     });
     alertDialog.setNegativeButton("Galeria", new DialogInterface.OnClickListener() {
         public void onClick(DialogInterface dialog, int which) {
             usarGaleria();
             dialog.cancel();
         }
     });

     alertDialog.show();

 }

From source file:ac.robinson.mediaphone.activity.NarrativeBrowserActivity.java

private void addNarrative() {
    // add a narrative by not passing a parent id - new narrative is created in FrameEditorActivity
    if (NarrativesManager.getTemplatesCount(getContentResolver()) > 0) {
        final CharSequence[] items = { getString(R.string.add_blank), getString(R.string.add_template) };
        AlertDialog.Builder builder = new AlertDialog.Builder(NarrativeBrowserActivity.this);
        builder.setTitle(R.string.title_add);
        builder.setIcon(android.R.drawable.ic_dialog_info);
        builder.setNegativeButton(android.R.string.cancel, null);
        builder.setItems(items, new DialogInterface.OnClickListener() {
            @Override/* w  w w. j a va2s.  c o  m*/
            public void onClick(DialogInterface dialog, int item) {
                mNarratives.setSelectionFromTop(0, 0); // so that the new narrative is visible
                switch (item) {
                case 0:
                    final Intent frameEditorIntent = new Intent(NarrativeBrowserActivity.this,
                            FrameEditorActivity.class);
                    startActivityForResult(frameEditorIntent, MediaPhone.R_id_intent_frame_editor);
                    break;
                case 1:
                    final Intent templateBrowserIntent = new Intent(NarrativeBrowserActivity.this,
                            TemplateBrowserActivity.class);
                    startActivityForResult(templateBrowserIntent, MediaPhone.R_id_intent_template_browser);
                    break;
                }
                dialog.dismiss();
            }
        });
        AlertDialog alert = builder.create();
        alert.show();
    } else {
        final Intent frameEditorIntent = new Intent(NarrativeBrowserActivity.this, FrameEditorActivity.class);
        startActivityForResult(frameEditorIntent, MediaPhone.R_id_intent_frame_editor);
    }
}