Java Code Examples for android.app.AlertDialog.Builder

The following code examples are extracted from open source projects. You can click to vote up the examples that are useful to you.

Example 1

From project Android-automation, under directory /TmtsApp/src/com/taobao/tmts/framework/app/.

Source file: MainActivity.java

  22 
vote

private void createDialogWithList(){
  Builder dialog=new AlertDialog.Builder(this);
  View view=getViewFromLayout(this,R.layout.listview_layout);
  initListView((ListView)view.findViewById(R.id.my_listview));
  dialog.setView(view);
  dialog.setNegativeButton("OK",new OnClickListener(){
    @Override public void onClick(    DialogInterface dialog,    int which){
    }
  }
);
  dialog.create();
  dialog.show();
}
 

Example 2

From project android-joedayz, under directory /Proyectos/FBConnectTest/src/com/facebook/android/.

Source file: Util.java

  22 
vote

/** 
 * Display a simple alert dialog with the given text and title.
 * @param context Android context in which the dialog should be displayed
 * @param title Alert dialog title
 * @param text Alert dialog message
 */
public static void showAlert(Context context,String title,String text){
  Builder alertBuilder=new Builder(context);
  alertBuilder.setTitle(title);
  alertBuilder.setMessage(text);
  alertBuilder.create().show();
}
 

Example 3

From project android-shuffle, under directory /client/src/org/dodgybits/shuffle/android/core/view/.

Source file: AlertUtils.java

  22 
vote

public static void showCleanUpInboxMessage(final Context context){
  CharSequence title=context.getString(R.string.info_title);
  CharSequence message=context.getString(R.string.clean_inbox_message);
  CharSequence buttonText=context.getString(R.string.ok_button_title);
  Builder builder=new Builder(context);
  builder.setTitle(title).setIcon(R.drawable.dialog_information).setMessage(message).setPositiveButton(buttonText,null);
  builder.create().show();
}
 

Example 4

From project Android-Simple-Social-Sharing, under directory /SimpleSocialSharing/src/com/nostra13/socialsharing/facebook/extpack/com/facebook/android/.

Source file: Util.java

  22 
vote

/** 
 * Display a simple alert dialog with the given text and title.
 * @param context Android context in which the dialog should be displayed
 * @param title Alert dialog title
 * @param text Alert dialog message
 */
public static void showAlert(Context context,String title,String text){
  Builder alertBuilder=new Builder(context);
  alertBuilder.setTitle(title);
  alertBuilder.setMessage(text);
  alertBuilder.create().show();
}
 

Example 5

From project android-tether, under directory /facebook/src/com/facebook/android/.

Source file: Util.java

  22 
vote

/** 
 * Display a simple alert dialog with the given text and title.
 * @param context Android context in which the dialog should be displayed
 * @param title Alert dialog title
 * @param text Alert dialog message
 */
public static void showAlert(Context context,String title,String text){
  Builder alertBuilder=new Builder(context);
  alertBuilder.setTitle(title);
  alertBuilder.setMessage(text);
  alertBuilder.create().show();
}
 

Example 6

From project BibleQuote-for-Android, under directory /src/com/BibleQuote/activity/.

Source file: BookmarksActivity.java

  22 
vote

public boolean onItemLongClick(AdapterView<?> a,View v,int position,long id){
  currBookmark=LV.getAdapter().getItem(position).toString();
  Builder b=new AlertDialog.Builder(BookmarksActivity.this);
  b.setIcon(R.drawable.icon);
  b.setTitle(currBookmark);
  b.setMessage(R.string.fav_question_del_fav);
  b.setPositiveButton("OK",positiveButton_OnClick);
  b.setNegativeButton(R.string.cancel,null);
  b.show();
  return true;
}
 

Example 7

From project Bitcoin-Wallet-for-Android, under directory /wallet/src/de/schildbach/wallet/ui/.

Source file: AbstractWalletActivity.java

  22 
vote

protected void parseErrorDialog(final String uri){
  final Builder dialog=new AlertDialog.Builder(this);
  dialog.setTitle(R.string.send_coins_uri_parse_error_title);
  dialog.setMessage(uri);
  dialog.setNeutralButton(R.string.button_dismiss,null);
  dialog.show();
}
 

Example 8

From project callmeter, under directory /src/de/ub0r/android/callmeter/ui/prefs/.

Source file: HourGroupEdit.java

  22 
vote

/** 
 * Show help text.
 * @param res resource
 */
private void showHelp(final int res){
  final Builder b=new Builder(this);
  b.setMessage(res);
  b.setPositiveButton(android.R.string.ok,null);
  b.show();
}
 

Example 9

From project Catroid-maven-playground, under directory /src/main/java/at/tugraz/ist/catroid/utils/.

Source file: Utils.java

  22 
vote

/** 
 * Displays an AlertDialog with the given error message and just a close button
 * @param context
 * @param errorMessage
 */
public static void displayErrorMessage(Context context,String errorMessage){
  Builder builder=new AlertDialog.Builder(context);
  builder.setTitle(context.getString(R.string.error));
  builder.setMessage(errorMessage);
  builder.setNeutralButton(context.getString(R.string.close),new OnClickListener(){
    public void onClick(    DialogInterface dialog,    int which){
    }
  }
);
  builder.show();
}
 

Example 10

From project dungbeetle, under directory /src/com/facebook/android/.

Source file: Util.java

  22 
vote

/** 
 * Display a simple alert dialog with the given text and title.
 * @param context Android context in which the dialog should be displayed
 * @param title Alert dialog title
 * @param text Alert dialog message
 */
public static void showAlert(Context context,String title,String text){
  Builder alertBuilder=new Builder(context);
  alertBuilder.setTitle(title);
  alertBuilder.setMessage(text);
  alertBuilder.create().show();
}
 

Example 11

From project facebook-android-sdk, under directory /facebook/src/com/facebook/android/.

Source file: Util.java

  22 
vote

/** 
 * Display a simple alert dialog with the given text and title.
 * @param context Android context in which the dialog should be displayed
 * @param title Alert dialog title
 * @param text Alert dialog message
 */
public static void showAlert(Context context,String title,String text){
  Builder alertBuilder=new Builder(context);
  alertBuilder.setTitle(title);
  alertBuilder.setMessage(text);
  alertBuilder.create().show();
}
 

Example 12

From project GSM-Signal-Tracking-, under directory /gpstracker/src/nl/sogeti/android/gpstracker/actions/.

Source file: ShareTrack.java

  22 
vote

@Override protected Dialog onCreateDialog(int id){
  Dialog dialog=null;
  Builder builder=null;
switch (id) {
case DIALOG_INSTALL_TWIDROID:
    builder=new AlertDialog.Builder(this);
  builder.setTitle(R.string.dialog_notwidroid).setMessage(R.string.dialog_notwidroid_message).setIcon(android.R.drawable.ic_dialog_alert).setPositiveButton(R.string.btn_install,mTwidroidDialogListener).setNegativeButton(R.string.btn_cancel,null);
dialog=builder.create();
return dialog;
default :
return super.onCreateDialog(id);
}
}
 

Example 13

From project MicDroid, under directory /src/com/intervigil/micdroid/helper/.

Source file: DialogHelper.java

  22 
vote

public static void showWarning(Context context,int titleId,int warningId){
  Builder warningBuilder=new AlertDialog.Builder(context);
  warningBuilder.setMessage(context.getString(warningId)).setTitle(context.getString(titleId)).setCancelable(false).setPositiveButton("Ok",new DialogInterface.OnClickListener(){
    public void onClick(    DialogInterface dialog,    int id){
      dialog.dismiss();
    }
  }
);
  warningBuilder.create().show();
}
 

Example 14

From project SocialLib, under directory /src/com/facebook/android/.

Source file: Util.java

  22 
vote

/** 
 * Display a simple alert dialog with the given text and title.
 * @param context Android context in which the dialog should be displayed
 * @param title Alert dialog title
 * @param text Alert dialog message
 */
public static void showAlert(Context context,String title,String text){
  Builder alertBuilder=new Builder(context);
  alertBuilder.setTitle(title);
  alertBuilder.setMessage(text);
  alertBuilder.create().show();
}
 

Example 15

From project SWE12-Drone, under directory /catroid/src/at/tugraz/ist/catroid/utils/.

Source file: Utils.java

  22 
vote

/** 
 * Displays an AlertDialog with the given error message and just a close button
 * @param context
 * @param errorMessage
 */
public static void displayErrorMessage(Context context,String errorMessage){
  Builder builder=new AlertDialog.Builder(context);
  builder.setTitle(context.getString(R.string.error));
  builder.setMessage(errorMessage);
  builder.setNeutralButton(context.getString(R.string.close),new OnClickListener(){
    public void onClick(    DialogInterface dialog,    int which){
    }
  }
);
  builder.show();
}
 

Example 16

From project TiVo-Commander, under directory /src/com/arantius/tivocommander/.

Source file: MyShows.java

  22 
vote

public void doSort(View v){
  ArrayAdapter<String> orderAdapter=new ArrayAdapter<String>(this,android.R.layout.select_dialog_item,mOrderLabels);
  Builder dialogBuilder=new AlertDialog.Builder(this);
  dialogBuilder.setTitle("Order?");
  dialogBuilder.setAdapter(orderAdapter,new DialogInterface.OnClickListener(){
    public void onClick(    DialogInterface dialog,    int position){
      mOrderBy=mOrderValues[position];
      startRequest();
    }
  }
);
  AlertDialog dialog=dialogBuilder.create();
  dialog.show();
}
 

Example 17

From project warda, under directory /facebook/src/com/facebook/android/.

Source file: Util.java

  22 
vote

/** 
 * Display a simple alert dialog with the given text and title.
 * @param context Android context in which the dialog should be displayed
 * @param title Alert dialog title
 * @param text Alert dialog message
 */
public static void showAlert(Context context,String title,String text){
  Builder alertBuilder=new Builder(context);
  alertBuilder.setTitle(title);
  alertBuilder.setMessage(text);
  alertBuilder.create().show();
}
 

Example 18

From project android-xbmcremote, under directory /src/org/xbmc/android/remote/presentation/controller/.

Source file: UrlIntentController.java

  21 
vote

private void maybePlayMovie(final Movie movie){
  final String message="Do you want to play\n" + movie.getName() + "\non XBMC?";
  boolean confirmPlayOnXBMC=getConfirmPlayOnXBMC();
  if (confirmPlayOnXBMC) {
    final Builder builder=new Builder(mActivity);
    builder.setTitle("Play Movie on XBMC?");
    builder.setMessage(message);
    builder.setCancelable(true);
    builder.setIcon(drawable.icon);
    builder.setNeutralButton("Yes",new android.content.DialogInterface.OnClickListener(){
      public void onClick(      DialogInterface dialog,      int which){
        playMovieThreaded(movie);
        mActivity.finish();
      }
    }
);
    builder.setCancelable(true);
    builder.setNegativeButton("No",new android.content.DialogInterface.OnClickListener(){
      public void onClick(      DialogInterface dialog,      int which){
        dialog.cancel();
        mActivity.finish();
      }
    }
);
    final AlertDialog alert=builder.create();
    try {
      alert.show();
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
  }
 else {
    playMovieThreaded(movie);
    mActivity.finish();
  }
}
 

Example 19

From project apps-for-android, under directory /BTClickLinkCompete/src/net/clc/bt/.

Source file: AirHockey.java

  21 
vote

public void OnConnectionLost(String device){
class displayConnectionLostAlert implements Runnable {
    public void run(){
      Builder connectionLostAlert=new Builder(self);
      connectionLostAlert.setTitle("Connection lost");
      connectionLostAlert.setMessage("Your connection with the other player has been lost.");
      connectionLostAlert.setPositiveButton("Ok",new OnClickListener(){
        public void onClick(        DialogInterface dialog,        int which){
          finish();
        }
      }
);
      connectionLostAlert.setCancelable(false);
      try {
        connectionLostAlert.show();
      }
 catch (      BadTokenException e) {
      }
    }
  }
  self.runOnUiThread(new displayConnectionLostAlert());
}
 

Example 20

From project danbooru-gallery-android, under directory /src/tw/idv/palatis/danboorugallery/.

Source file: DanbooruGalleryPreferenceActivity.java

  21 
vote

@Override public void onClick(DialogInterface idialog,int which){
  final AlertDialog dialog=(AlertDialog)idialog;
  final EditText edit_name=(EditText)dialog.findViewById(R.id.preferences_hosts_dialog_hosts_name_input);
  final EditText edit_url=(EditText)dialog.findViewById(R.id.preferences_hosts_dialog_url_input);
  final Spinner api=(Spinner)dialog.findViewById(R.id.preferences_hosts_dialog_api);
switch (which) {
case DialogInterface.BUTTON_POSITIVE:
    if (edit_name.getTag() == null)     newHost(edit_name.getText().toString(),edit_url.getText().toString(),api.getSelectedItem().toString());
 else     editHost((Integer)edit_name.getTag(),edit_name.getText().toString(),edit_url.getText().toString(),api.getSelectedItem().toString());
  break;
case DialogInterface.BUTTON_NEUTRAL:
Builder builder=new AlertDialog.Builder(dialog.getContext());
builder.setTitle(R.string.preferences_hosts_dialog_delete_confirm_title);
Host host=hosts.get((Integer)edit_name.getTag());
builder.setMessage(String.format(getString(R.string.preferences_hosts_dialog_delete_confirm_message),host.name,host.url));
builder.setPositiveButton(android.R.string.ok,new OnClickListener(){
@Override public void onClick(DialogInterface dialog,int which){
deleteHost((Integer)edit_name.getTag());
}
}
);
builder.setNegativeButton(android.R.string.cancel,null);
builder.create().show();
break;
}
}
 

Example 21

From project DeskSMS, under directory /DeskSMS/src/com/koushikdutta/desktopsms/.

Source file: Helper.java

  21 
vote

static public void showAlertDialog(Context context,String s,DialogInterface.OnClickListener okCallback){
  AlertDialog.Builder builder=new Builder(context);
  builder.setMessage(s);
  builder.setPositiveButton(android.R.string.ok,okCallback);
  builder.setCancelable(false);
  builder.create().show();
}
 

Example 22

From project droid-fu, under directory /src/main/java/com/github/droidfu/activities/.

Source file: BetterActivityHelper.java

  21 
vote

public static <T>Dialog newListDialog(final Activity context,String dialogTitle,final List<T> elements,final DialogClickListener<T> listener,final boolean closeOnSelect,int selectedItem){
  final int entriesSize=elements.size();
  String[] entries=new String[entriesSize];
  for (int i=0; i < entriesSize; i++) {
    entries[i]=elements.get(i).toString();
  }
  Builder builder=new AlertDialog.Builder(context);
  if (dialogTitle != null) {
    builder.setTitle(dialogTitle);
  }
  builder.setSingleChoiceItems(entries,selectedItem,new DialogInterface.OnClickListener(){
    public void onClick(    DialogInterface dialog,    int which){
      if (closeOnSelect)       dialog.dismiss();
      listener.onClick(which,elements.get(which));
    }
  }
);
  return builder.create();
}
 

Example 23

From project fanfoudroid, under directory /src/com/ch_linghu/fanfoudroid/.

Source file: ProfileActivity.java

  21 
vote

@Override public void onClick(View v){
  Builder diaBuilder=new AlertDialog.Builder(ProfileActivity.this).setTitle("??????").setMessage("?????????????");
  diaBuilder.setPositiveButton("???",new DialogInterface.OnClickListener(){
    @Override public void onClick(    DialogInterface dialog,    int which){
      if (setFollowingTask != null && setFollowingTask.getStatus() == GenericTask.Status.RUNNING) {
        return;
      }
 else {
        setFollowingTask=new SetFollowingTask();
        setFollowingTask.setListener(setFollowingTaskLinstener);
        TaskParams params=new TaskParams();
        setFollowingTask.execute(params);
      }
    }
  }
);
  diaBuilder.setNegativeButton("???",new DialogInterface.OnClickListener(){
    @Override public void onClick(    DialogInterface dialog,    int which){
      dialog.dismiss();
    }
  }
);
  Dialog dialog=diaBuilder.create();
  dialog.show();
}
 

Example 24

From project ignition, under directory /ignition-core/ignition-core-lib/src/com/github/ignition/core/dialogs/.

Source file: IgnitedDialogs.java

  21 
vote

public static <T>AlertDialog.Builder newListDialog(final Activity context,String title,final List<T> elements,final DialogClickListener<T> listener,final boolean closeOnSelect,int selectedItem){
  final int entriesSize=elements.size();
  String[] entries=new String[entriesSize];
  for (int i=0; i < entriesSize; i++) {
    entries[i]=elements.get(i).toString();
  }
  Builder builder=new AlertDialog.Builder(context);
  if (title != null) {
    builder.setTitle(title);
  }
  builder.setSingleChoiceItems(entries,selectedItem,new DialogInterface.OnClickListener(){
    @Override public void onClick(    DialogInterface dialog,    int which){
      if (closeOnSelect) {
        dialog.dismiss();
      }
      listener.onClick(which,elements.get(which));
    }
  }
);
  return builder;
}
 

Example 25

From project MIT-Mobile-for-Android, under directory /src/edu/mit/mitmobile2/facilities/.

Source file: FacilitiesDetailsActivity.java

  21 
vote

@Override protected void onPreExecute(){
  mProblemDescription=mProblemDescriptionEditText.getText().toString().trim();
  mEmail=sendAsEditText.getText().toString().trim();
  if (mProblemDescription.length() == 0 || mEmail.length() == 0) {
    Builder builder=new AlertDialog.Builder(mContext);
    builder.setMessage("Email and a description of the problem is required.");
    builder.setNeutralButton("Okay",null);
    AlertDialog dialog=builder.create();
    dialog.show();
    FileUploader.this.cancel(true);
    return;
  }
  mUploadEntity=new CountingMultipartEntity(this);
  mProgressDialog=new ProgressDialog(mContext);
  mProgressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
  mProgressDialog.setMessage("Uploading Data");
  mProgressDialog.setIndeterminate(false);
  mProgressDialog.setOnCancelListener(new DialogInterface.OnCancelListener(){
    @Override public void onCancel(    DialogInterface dialog){
      mUploadEntity.cancel();
      FileUploader.this.cancel(true);
    }
  }
);
  mProgressDialog.show();
}
 

Example 26

From project Orweb, under directory /src/info/guardianproject/browser/.

Source file: EditPreferences.java

  21 
vote

@Override public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen,Preference preference){
  super.onPreferenceTreeClick(preferenceScreen,preference);
  if (preference == mAddSite) {
    AddSiteDialog asd=new AddSiteDialog(this);
    asd.setOnDismissListener(this);
    asd.show();
  }
 else   if (preference instanceof WhitelistItemPreference) {
    mLastSelected=(WhitelistItemPreference)preference;
    AlertDialog.Builder b=new Builder(this);
    b.setTitle(mLastSelected.getSite()).setPositiveButton("Delete",this).setNeutralButton("Cancel",null).show();
  }
  return false;
}
 

Example 27

From project rapidandroid, under directory /rapidandroid/org.rapidandroid/src/org/rapidandroid/activity/.

Source file: Dashboard.java

  21 
vote

/** 
 * @deprecated
 */
@Deprecated private void startActivityDateRange(){
  Intent i=new Intent(this,DateRange.class);
  Date endDate=new Date();
  if (mChosenForm != null) {
    endDate=ParsedDataReporter.getOldestMessageDate(this,mChosenForm);
    if (endDate.equals(Constants.NULLDATE)) {
      Builder noDateDialog=new AlertDialog.Builder(this);
      noDateDialog.setPositiveButton("Ok",null);
      noDateDialog.setTitle("Alert");
      noDateDialog.setMessage("This form has no messages or data to chart");
      noDateDialog.show();
      return;
    }
  }
 else {
    endDate=MessageDataReporter.getOldestMessageDate(this);
  }
  i.putExtra(DateRange.CallParams.ACTIVITY_ARG_STARTDATE,endDate.getTime());
}
 

Example 28

From project Sketchy-Truck, under directory /andengine/src/org/anddev/andengine/util/.

Source file: BetaUtils.java

  21 
vote

public static boolean finishWhenExpired(final Activity pActivity,final GregorianCalendar pExpirationDate,final int pTitleResourceID,final int pMessageResourceID,final Intent pOkIntent,final Intent pCancelIntent){
  final SharedPreferences spref=SimplePreferences.getInstance(pActivity);
  final long now=System.currentTimeMillis();
  final long lastuse=Math.max(now,spref.getLong(PREFERENCES_BETAUTILS_ID,-1));
  spref.edit().putLong(PREFERENCES_BETAUTILS_ID,lastuse).commit();
  final GregorianCalendar lastuseDate=new GregorianCalendar();
  lastuseDate.setTimeInMillis(lastuse);
  if (lastuseDate.after(pExpirationDate)) {
    final Builder alertDialogBuilder=new AlertDialog.Builder(pActivity).setTitle(pTitleResourceID).setIcon(R.drawable.ic_dialog_alert).setMessage(pMessageResourceID);
    alertDialogBuilder.setPositiveButton(android.R.string.ok,new DialogInterface.OnClickListener(){
      @Override public void onClick(      final DialogInterface pDialog,      final int pWhich){
        if (pOkIntent != null) {
          pActivity.startActivity(pOkIntent);
        }
        pActivity.finish();
      }
    }
);
    alertDialogBuilder.setNegativeButton(android.R.string.cancel,new OnClickListener(){
      @Override public void onClick(      final DialogInterface pDialog,      final int pWhich){
        if (pCancelIntent != null) {
          pActivity.startActivity(pCancelIntent);
        }
        pActivity.finish();
      }
    }
).create().show();
    return true;
  }
 else {
    return false;
  }
}
 

Example 29

From project smsdroid, under directory /src/de/ub0r/android/smsdroid/.

Source file: ConversationListActivity.java

  21 
vote

/** 
 * Delete messages with a given  {@link Uri}.
 * @param context {@link Context}
 * @param uri {@link Uri}
 * @param title title of Dialog
 * @param message message of the Dialog
 * @param activity {@link Activity} to finish when deleting.
 */
static void deleteMessages(final Context context,final Uri uri,final int title,final int message,final Activity activity){
  Log.i(TAG,"deleteMessages(..," + uri + " ,..)");
  final Builder builder=new Builder(context);
  builder.setTitle(title);
  builder.setMessage(message);
  builder.setNegativeButton(android.R.string.no,null);
  builder.setPositiveButton(android.R.string.yes,new DialogInterface.OnClickListener(){
    @Override public void onClick(    final DialogInterface dialog,    final int which){
      final int ret=context.getContentResolver().delete(uri,null,null);
      Log.d(TAG,"deleted: " + ret);
      if (activity != null && !activity.isFinishing()) {
        activity.finish();
      }
      if (ret > 0) {
        Conversation.flushCache();
        Message.flushCache();
        SmsReceiver.updateNewMessageNotification(context,null);
      }
    }
  }
);
  builder.show();
}
 

Example 30

From project SORMA, under directory /sorma/examples/sorma-address-book/src/com/gaoshin/sorma/addressbook/.

Source file: EditContactActivity.java

  21 
vote

private void setupDeleteButton(){
  Button btn=(Button)findViewById(R.id.deleteBtn);
  btn.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      Builder dialog=new AlertDialog.Builder(v.getContext());
      dialog.setTitle("Are you sure?");
      dialog.setPositiveButton("Delete It!",new DialogInterface.OnClickListener(){
        @Override public void onClick(        DialogInterface dialog,        int which){
          sorma.delete(Contact.class,"_id=" + contact.getId(),null);
          sorma.delete(Phone.class,"contactId=" + contact.getId(),null);
          dialog.dismiss();
          finish();
        }
      }
);
      dialog.setNegativeButton("Cancel",new DialogInterface.OnClickListener(){
        @Override public void onClick(        DialogInterface dialog,        int which){
          dialog.dismiss();
        }
      }
);
      dialog.show();
    }
  }
);
}
 

Example 31

From project ToolkitForAndroid, under directory /src/main/java/com/apkits/android/network/.

Source file: Network.java

  21 
vote

/** 
 * </br><b>description :</b>???????????? </br><b>time :</b>       2012-7-18 ???7:46:13
 * @param c
 * @param status
 */
public static void showNetworkSetting(final Activity activity){
  AlertDialog.Builder builder=new Builder(activity);
  builder.setTitle("?????????").setMessage("??????????,??????????").setPositiveButton("???",new DialogInterface.OnClickListener(){
    @Override public void onClick(    DialogInterface dialog,    int which){
      activity.startActivity(new Intent(android.provider.Settings.ACTION_SETTINGS));
    }
  }
).setNegativeButton("???",new DialogInterface.OnClickListener(){
    @Override public void onClick(    DialogInterface dialog,    int which){
      dialog.dismiss();
    }
  }
).show();
}
 

Example 32

From project TPT-Helper, under directory /TPT Helper/src/com/amphoras/tpthelper/.

Source file: CustomTPTGen2Gen3.java

  21 
vote

@Override protected Dialog onCreateDialog(int id){
switch (id) {
case PICK_GEN:
    Builder builder1=new AlertDialog.Builder(CustomTPTGen2Gen3.this);
  builder1.setTitle(R.string.pick_gen);
builder1.setCancelable(false);
CharSequence cancel=getText(R.string.cancel);
final CharSequence[] tpts={"Gen 2 TPT",cancel};
builder1.setItems(tpts,new DialogInterface.OnClickListener(){
public void onClick(DialogInterface dialog,int item){
switch (item) {
case 0:
Intent gen_2=new Intent(CustomTPTGen2Gen3.this,CustomTPTGen2.class);
startActivity(gen_2);
CustomTPTGen2Gen3.this.finish();
break;
case 1:
CustomTPTGen2Gen3.this.finish();
break;
}
}
}
);
return builder1.create();
}
return super.onCreateDialog(id);
}
 

Example 33

From project travellog, under directory /src/de/ub0r/android/travelLog/ui/.

Source file: Logs.java

  21 
vote

/** 
 * {@inheritDoc}
 */
@Override public Dialog onCreateDialog(final int id){
  Builder b;
switch (id) {
case DIALOG_CLEAR:
    b=new Builder(this);
  b.setTitle(R.string.clear_);
b.setMessage(R.string.clear_hint);
b.setPositiveButton(android.R.string.ok,new DialogInterface.OnClickListener(){
@Override public void onClick(final DialogInterface dialog,final int which){
  Logs.this.getContentResolver().delete(DataProvider.Logs.CONTENT_URI,null,null);
  Logs.this.requery();
}
}
);
b.setNegativeButton(android.R.string.cancel,null);
return b.create();
default :
return null;
}
}
 

Example 34

From project Book-Catalogue, under directory /src/com/eleybourn/bookcatalogue/.

Source file: StandardDialogs.java

  20 
vote

/** 
 * Show a dialog asking if unsaved edits should be ignored. Finish if so.
 */
public static void showConfirmUnsavedEditsDialog(final Activity a){
  AlertDialog.Builder dialog=new Builder(a);
  dialog.setTitle(R.string.confirm_exit);
  dialog.setMessage(R.string.you_may_have_unsaved_changes);
  dialog.setPositiveButton(R.string.ok,new AlertDialog.OnClickListener(){
    @Override public void onClick(    DialogInterface dialog,    int which){
      dialog.dismiss();
      a.finish();
    }
  }
);
  dialog.setNegativeButton(R.string.cancel,new AlertDialog.OnClickListener(){
    @Override public void onClick(    DialogInterface dialog,    int which){
      dialog.dismiss();
    }
  }
);
  dialog.setCancelable(false);
  dialog.create().show();
}
 

Example 35

From project RA_Launcher, under directory /src/com/android/ra/launcher/settings/.

Source file: LauncherActionPreference.java

  20 
vote

@Override protected void onClick(){
  AlertDialog.Builder builder=new Builder(getContext());
  builder.setTitle(this.getTitle());
  final ListAdapter adapter=LauncherActions.getInstance().getSelectActionAdapter();
  builder.setAdapter(adapter,new OnClickListener(){
    @Override public void onClick(    DialogInterface dialog,    int which){
      Action act=(Action)adapter.getItem(which);
      Intent intent=LauncherActions.getInstance().getIntentForAction(act);
      String sIntent=intent.toUri(0).toString();
      persistString(sIntent);
    }
  }
);
  builder.create().show();
}
 

Example 36

From project TahoeLAFS-android, under directory /src/org/openintents/distribution/.

Source file: UpdateMenu.java

  20 
vote

/** 
 * Shows dialog box with option to upgrade.
 * @param context
 */
public static void showUpdateBox(final Context context){
  String version=null;
  try {
    version=context.getPackageManager().getPackageInfo(context.getPackageName(),0).versionName;
  }
 catch (  NameNotFoundException e) {
    e.printStackTrace();
  }
  final Intent intent=new Intent(Intent.ACTION_VIEW);
  new Builder(context).setMessage(context.getString(RD.string.update_box_text,version)).setPositiveButton(RD.string.update_check_now,new OnClickListener(){
    public void onClick(    DialogInterface arg0,    int arg1){
      intent.setData(Uri.parse(context.getString(RD.string.update_app_url)));
      startSaveActivity(context,intent);
    }
  }
).setNegativeButton(RD.string.update_get_updater,new OnClickListener(){
    public void onClick(    DialogInterface dialog,    int which){
      intent.setData(Uri.parse(context.getString(RD.string.update_checker_url)));
      startSaveActivity(context,intent);
    }
  }
).show();
}
 

Example 37

From project android_8, under directory /src/com/defuzeme/gui/.

Source file: Gui.java

  19 
vote

public void showAlertDialog(int title,int content){
  Gui._builder=new AlertDialog.Builder(this._activity);
  Gui._builder.setTitle(title);
  Gui._builder.setMessage(content);
  Gui._builder.setPositiveButton(android.R.string.ok,null);
  Gui._builder.setCancelable(false);
  Gui._builder.create().show();
}
 

Example 38

From project BF3-Battlelog, under directory /src/com/kmansoft/.

Source file: IntegerListPreference.java

  19 
vote

@Override protected void onPrepareDialogBuilder(Builder builder){
  super.onPrepareDialogBuilder(builder);
  if (mEntries == null || mValues == null) {
    throw new IllegalStateException("IntegerListPreference requires an entryList and a valueList.");
  }
  mClickedDialogEntryIndex=getValueIndex();
  builder.setSingleChoiceItems(mEntries,mClickedDialogEntryIndex,new DialogInterface.OnClickListener(){
    public void onClick(    DialogInterface dialog,    int which){
      mClickedDialogEntryIndex=which;
    }
  }
);
}
 

Example 39

From project droidparts, under directory /extra/src/org/droidparts/preference/.

Source file: MultiSelectListPreference.java

  19 
vote

@Override protected void onPrepareDialogBuilder(Builder builder){
  updateCheckedEntryIndexes();
  builder.setMultiChoiceItems(getEntries(),checkedEntryIndexes,new OnMultiChoiceClickListener(){
    @Override public void onClick(    DialogInterface dialog,    int which,    boolean isChecked){
      checkedEntryIndexes[which]=isChecked;
    }
  }
);
}
 

Example 40

From project Dual-Battery-Widget, under directory /src/org/flexlabs/widgets/dualbattery/ui/.

Source file: IntegerListPreference.java

  19 
vote

@Override protected void onPrepareDialogBuilder(Builder builder){
  super.onPrepareDialogBuilder(builder);
  if (mEntries == null || mEntryValues == null) {
    throw new IllegalStateException("ListPreference requires an entries array and an entryValues array.");
  }
  mClickedDialogEntryIndex=getValueIndex();
  builder.setSingleChoiceItems(mEntries,mClickedDialogEntryIndex,new DialogInterface.OnClickListener(){
    public void onClick(    DialogInterface dialog,    int which){
      mClickedDialogEntryIndex=which;
      IntegerListPreference.this.onClick(dialog,DialogInterface.BUTTON_POSITIVE);
      dialog.dismiss();
    }
  }
);
  builder.setPositiveButton(null,null);
}
 

Example 41

From project ElectricSleep, under directory /src/com/androsz/electricsleepbeta/alarmclock/.

Source file: RepeatPreference.java

  19 
vote

@Override protected void onPrepareDialogBuilder(final Builder builder){
  final CharSequence[] entries=getEntries();
  getEntryValues();
  builder.setMultiChoiceItems(entries,mDaysOfWeek.getBooleanArray(),new DialogInterface.OnMultiChoiceClickListener(){
    @Override public void onClick(    final DialogInterface dialog,    final int which,    final boolean isChecked){
      mNewDaysOfWeek.set(which,isChecked);
    }
  }
);
}
 

Example 42

From project Jota-Text-Editor, under directory /src/jp/sblo/pandora/jota/.

Source file: SettingsActivity.java

  19 
vote

public boolean onPreferenceClick(Preference preference){
  new AlertDialog.Builder(SettingsActivity.this).setMessage(getString(R.string.msg_init_setting)).setTitle(R.string.label_init).setPositiveButton(R.string.label_ok,new DialogInterface.OnClickListener(){
    public void onClick(    DialogInterface dialog,    int which){
      dialog.dismiss();
      final SharedPreferences sp=PreferenceManager.getDefaultSharedPreferences(SettingsActivity.this);
      Editor editor=sp.edit();
      editor.putInt(KEY_LASTVERSION,0);
      editor.commit();
      isVersionUp(SettingsActivity.this);
      finish();
    }
  }
).setNegativeButton(R.string.label_cancel,new DialogInterface.OnClickListener(){
    public void onClick(    DialogInterface dialog,    int which){
      dialog.dismiss();
    }
  }
).show();
  return false;
}
 

Example 43

From project Juggernaut_SystemUI, under directory /src/com/android/systemui/statusbar/powerwidget/.

Source file: MultiSelectListPreference.java

  19 
vote

@Override protected void onPrepareDialogBuilder(Builder builder){
  CharSequence[] entries=getEntries();
  CharSequence[] entryValues=getEntryValues();
  if (entries == null || entryValues == null || entries.length != entryValues.length) {
    throw new IllegalStateException(this.getClass().getSimpleName() + " requires an entries array and an entryValues array which are both the same length");
  }
  mClickedDialogEntryIndices=new boolean[entryValues.length];
  restoreCheckedEntries();
  builder.setMultiChoiceItems(entries,mClickedDialogEntryIndices,new DialogInterface.OnMultiChoiceClickListener(){
    @Override public void onClick(    DialogInterface dialog,    int which,    boolean isChecked){
      mClickedDialogEntryIndices[which]=isChecked;
    }
  }
);
}
 

Example 44

From project k-9, under directory /src/com/fsck/k9/preferences/.

Source file: CheckBoxListPreference.java

  19 
vote

@Override protected void onPrepareDialogBuilder(final Builder builder){
  mPendingItems=new boolean[mItems.length];
  System.arraycopy(mCheckedItems,0,mPendingItems,0,mCheckedItems.length);
  builder.setMultiChoiceItems(mItems,mPendingItems,new DialogInterface.OnMultiChoiceClickListener(){
    @Override public void onClick(    final DialogInterface dialog,    final int which,    final boolean isChecked){
      mPendingItems[which]=isChecked;
    }
  }
);
}
 

Example 45

From project KeyboardTerm, under directory /src/tw/kenshinn/keyboardTerm/.

Source file: AddressBookActivity.java

  19 
vote

@Override public void onResume(){
  super.onResume();
  if (dbUtils == null)   dbUtils=new DBUtils(this);
  prefs=PreferenceManager.getDefaultSharedPreferences(this);
  if (!prefs.getBoolean("INITIALIZED",false)) {
    initHost();
    initFunctionBtns();
    Editor editor=prefs.edit();
    editor.putBoolean("INITIALIZED",true);
    editor.commit();
    AlertDialog.Builder builder=new AlertDialog.Builder(AddressBookActivity.this);
    builder.setMessage(R.string.initial_message);
    builder.setPositiveButton("OK",null);
    builder.show();
  }
  this.getListView().setOnItemClickListener(new OnItemClickListener(){
    public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      Host host=getRealHost(position);
      Log.i(TAG,host.getHost());
      connect(host);
    }
  }
);
  this.registerForContextMenu(this.getListView());
  update();
}
 

Example 46

From project LEGO-MINDSTORMS-MINDdroid, under directory /android/src/com/lego/minddroid/.

Source file: FileDialog.java

  19 
vote

/** 
 * Shows the dialog
 * @param startStop when true shows another title (for leJOSMINDdroid)
 */
public void show(boolean startStop){
  AlertDialog.Builder builder=new AlertDialog.Builder(myActivity);
  builder.setTitle(myActivity.getResources().getString(startStop ? R.string.file_dialog_title_1 : R.string.file_dialog_title_2));
  builder.setItems(programs,new DialogInterface.OnClickListener(){
    public void onClick(    DialogInterface dialog,    int item){
      startProgram(item);
    }
  }
);
  builder.create().show();
}
 

Example 47

From project LigiAndroidCommons, under directory /src/org/ligi/android/common/preferences/.

Source file: SeekBarPreference.java

  19 
vote

protected void onPrepareDialogBuilder(Builder builder){
  LinearLayout layout=new LinearLayout(context);
  layout.setOrientation(LinearLayout.VERTICAL);
  layout.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT,LinearLayout.LayoutParams.WRAP_CONTENT));
  layout.setMinimumWidth(400);
  layout.setPadding(20,20,20,20);
  edit_text=new EditText(context);
  edit_text.setInputType(InputType.TYPE_CLASS_NUMBER);
  edit_text.setText("" + getPersistedInt(0));
  layout.addView(edit_text);
  seek_bar=new SeekBar(context);
  seek_bar.setMax(max);
  seek_bar.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,ViewGroup.LayoutParams.WRAP_CONTENT));
  seek_bar.setOnSeekBarChangeListener(this);
  seek_bar.setProgress(getPersistedInt(0));
  layout.addView(seek_bar);
  builder.setView(layout);
  super.onPrepareDialogBuilder(builder);
}
 

Example 48

From project myPlan, under directory /src/com/conzebit/myplan/android/activity/.

Source file: ListPreferenceMultiSelect.java

  19 
vote

@Override protected void onPrepareDialogBuilder(Builder builder){
  CharSequence[] entries=getEntries();
  CharSequence[] entryValues=getEntryValues();
  if (entries == null || entryValues == null || entries.length != entryValues.length) {
    throw new IllegalStateException("ListPreference requires an entries array and an entryValues array which are both the same length");
  }
  restoreCheckedEntries();
  builder.setMultiChoiceItems(entries,mClickedDialogEntryIndices,new DialogInterface.OnMultiChoiceClickListener(){
    public void onClick(    DialogInterface dialog,    int which,    boolean val){
      mClickedDialogEntryIndices[which]=val;
    }
  }
);
}
 

Example 49

From project OneMoreDream, under directory /src/com/dixheure/.

Source file: RepeatPreference.java

  19 
vote

@Override protected void onPrepareDialogBuilder(Builder builder){
  CharSequence[] entries=getEntries();
  CharSequence[] entryValues=getEntryValues();
  builder.setMultiChoiceItems(entries,mDaysOfWeek.getBooleanArray(),new DialogInterface.OnMultiChoiceClickListener(){
    public void onClick(    DialogInterface dialog,    int which,    boolean isChecked){
      mNewDaysOfWeek.set(which,isChecked);
    }
  }
);
}
 

Example 50

From project packages_apps_BlackICEControl, under directory /src/com/scheffsblend/smw/Preferences/.

Source file: ImageListPreference.java

  19 
vote

/** 
 * {@inheritDoc}
 */
protected void onPrepareDialogBuilder(Builder builder){
  int index=findIndexOfValue(getSharedPreferences().getString(getKey(),"1"));
  ListAdapter listAdapter=new ImageArrayAdapter(getContext(),R.layout.image_list_preference,getEntries(),resourceIds,index);
  builder.setAdapter(listAdapter,this);
  super.onPrepareDialogBuilder(builder);
}
 

Example 51

From project packages_apps_ROMControl, under directory /src/com/aokp/romcontrol/fragments/.

Source file: LEDControl.java

  19 
vote

@Override public void onClick(View v){
  final int place=currentSelectedApp;
  String selectedApp=unicornApps.get(place);
  AlertDialog.Builder ad=new AlertDialog.Builder(mActivity);
  ad.setTitle(R.string.led_custom_title);
  ad.setIcon(R.mipmap.ic_launcher);
  ad.setMessage(getResources().getString(R.string.led_custom_message) + selectedApp + "?");
  ad.setPositiveButton(R.string.led_change_app,new DialogInterface.OnClickListener(){
    @Override public void onClick(    DialogInterface dialog,    int which){
      mPicker.pickShortcut();
      int key=place - 1;
      unicornApps.remove(place);
      String hashKey=appList.get(key);
      appList.remove(key);
      customAppList.remove(hashKey);
      adapterRefreshSetting();
      saveCustomApps();
    }
  }
);
  ad.setNeutralButton(R.string.led_delete_app,new DialogInterface.OnClickListener(){
    @Override public void onClick(    DialogInterface dialog,    int which){
      int key=place - 1;
      unicornApps.remove(place);
      String hashKey=appList.get(key);
      appList.remove(key);
      customAppList.remove(hashKey);
      adapterRefreshSetting();
      saveCustomApps();
    }
  }
);
  ad.setNegativeButton(R.string.led_keep_app,new DialogInterface.OnClickListener(){
    @Override public void onClick(    DialogInterface dialog,    int which){
      dialog.dismiss();
    }
  }
);
  ad.show();
}
 

Example 52

From project platform_packages_apps_alarmclock, under directory /src/com/android/alarmclock/.

Source file: RepeatPreference.java

  19 
vote

@Override protected void onPrepareDialogBuilder(Builder builder){
  CharSequence[] entries=getEntries();
  CharSequence[] entryValues=getEntryValues();
  builder.setMultiChoiceItems(entries,mDaysOfWeek.getBooleanArray(),new DialogInterface.OnMultiChoiceClickListener(){
    public void onClick(    DialogInterface dialog,    int which,    boolean isChecked){
      mNewDaysOfWeek.set(which,isChecked);
    }
  }
);
}
 

Example 53

From project proxydroid, under directory /src/com/ksmaze/android/preference/.

Source file: ListPreferenceMultiSelect.java

  19 
vote

@Override protected void onPrepareDialogBuilder(Builder builder){
  CharSequence[] entries=getEntries();
  CharSequence[] entryValues=getEntryValues();
  if (entries == null || entryValues == null || entries.length != entryValues.length) {
    throw new IllegalStateException("ListPreference requires an entries array and an entryValues array which are both the same length");
  }
  restoreCheckedEntries();
  builder.setMultiChoiceItems(entries,mClickedDialogEntryIndices,new DialogInterface.OnMultiChoiceClickListener(){
    @Override public void onClick(    DialogInterface dialog,    int which,    boolean val){
      mClickedDialogEntryIndices[which]=val;
    }
  }
);
}
 

Example 54

From project QuotaForAndroid, under directory /Quota/src/com/southfreo/quota/control/.

Source file: UIManager.java

  19 
vote

public void showProviderChoice(final Provider p,Context c,String[] choices){
  AlertDialog.Builder builder=new AlertDialog.Builder(c);
  builder.setTitle("Please Choose");
  builder.setSingleChoiceItems(choices,0,new DialogInterface.OnClickListener(){
    public void onClick(    DialogInterface dialog,    int item){
      p.questionAnswered=true;
      p.questioninProgress=false;
      p.questionanswer=item;
      dialog.dismiss();
    }
  }
);
  AlertDialog alert=builder.create();
  alert.setOnCancelListener(new DialogInterface.OnCancelListener(){
    @Override public void onCancel(    DialogInterface dialog){
      p.questioninProgress=false;
      p.questionAnswered=true;
      p.questionanswer=0;
      dialog.dismiss();
    }
  }
);
  alert.show();
}
 

Example 55

From project sls, under directory /src/com/adam/aslfms/.

Source file: SeekBarPreference.java

  19 
vote

@Override protected void onPrepareDialogBuilder(Builder builder){
  LinearLayout layout=new LinearLayout(mContext);
  layout.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT,LinearLayout.LayoutParams.WRAP_CONTENT));
  layout.setPadding(20,20,20,20);
  mSeekBar=new SeekBar(mContext);
  mSeekBar.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,ViewGroup.LayoutParams.WRAP_CONTENT));
  mSeekBar.setMax(mStartMax);
  mSeekBar.setProgress(mStartProgress);
  layout.addView(mSeekBar);
  builder.setView(layout);
  super.onPrepareDialogBuilder(builder);
}
 

Example 56

From project Synodroid, under directory /src/com/bigpupdev/synodroid/preference/.

Source file: ListPreferenceMultiSelect.java

  19 
vote

@Override protected void onPrepareDialogBuilder(Builder builder){
  CharSequence[] entries=getEntries();
  CharSequence[] entryValues=getEntryValues();
  if (entries == null || entryValues == null || entries.length != entryValues.length) {
    throw new IllegalStateException("ListPreference requires an entries array and an entryValues array which are both the same length");
  }
  restoreCheckedEntries();
  builder.setMultiChoiceItems(entries,mClickedDialogEntryIndices,new DialogInterface.OnMultiChoiceClickListener(){
    public void onClick(    DialogInterface dialog,    int which,    boolean val){
      mClickedDialogEntryIndices[which]=val;
    }
  }
);
}
 

Example 57

From project twidere, under directory /src/org/mariotaku/twidere/preference/.

Source file: ColorPickerPreference.java

  19 
vote

@Override protected void onPrepareDialogBuilder(final Builder builder){
  super.onPrepareDialogBuilder(builder);
  final Context context=getContext();
  final LinearLayout view=new LinearLayout(context);
  view.setOrientation(LinearLayout.VERTICAL);
  mColorPicker=new ColorPickerView(context);
  mColorPicker.setOnColorChangedListener(this);
  view.addView(mColorPicker,LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT);
  view.setPadding(Math.round(mColorPicker.getDrawingOffset()),0,Math.round(mColorPicker.getDrawingOffset()),0);
  mColorPicker.setColor(mValue,true);
  mColorPicker.setAlphaSliderVisible(mAlphaSliderEnabled);
  builder.setView(view);
  builder.setIcon(new BitmapDrawable(context.getResources(),getColorPreviewBitmap(context,mValue)));
  builder.setPositiveButton(android.R.string.ok,this);
  builder.setNegativeButton(android.R.string.cancel,null);
}
 

Example 58

From project vanilla, under directory /src/org/kreed/vanilla/.

Source file: IdlePreference.java

  19 
vote

@Override protected void onPrepareDialogBuilder(Builder builder){
  Context context=getContext();
  ViewGroup.LayoutParams params=new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.WRAP_CONTENT);
  mValue=getPersistedInt(DEFAULT_VALUE);
  LinearLayout layout=new LinearLayout(context);
  layout.setOrientation(LinearLayout.VERTICAL);
  layout.setLayoutParams(params);
  mValueText=new TextView(context);
  mValueText.setGravity(Gravity.RIGHT);
  mValueText.setPadding(20,0,20,0);
  layout.addView(mValueText);
  SeekBar seekBar=new SeekBar(context);
  seekBar.setPadding(20,0,20,20);
  seekBar.setLayoutParams(params);
  seekBar.setMax(1000);
  seekBar.setProgress((int)(Math.pow((float)(mValue - MIN) / (MAX - MIN),0.25f) * 1000));
  seekBar.setOnSeekBarChangeListener(this);
  layout.addView(seekBar);
  updateText();
  builder.setView(layout);
}
 

Example 59

From project websms, under directory /src/de/ub0r/android/websms/.

Source file: WebSMS.java

  19 
vote

/** 
 * {@inheritDoc}
 */
@Override protected final Dialog onCreateDialog(final int id){
  AlertDialog.Builder builder;
switch (id) {
case DIALOG_CUSTOMSENDER:
    builder=new AlertDialog.Builder(this);
  builder.setTitle(R.string.custom_sender);
builder.setCancelable(true);
final EditText et=new EditText(this);
builder.setView(et);
builder.setPositiveButton(android.R.string.ok,new DialogInterface.OnClickListener(){
public void onClick(final DialogInterface dialog,final int id){
WebSMS.lastCustomSender=et.getText().toString();
}
}
);
builder.setNegativeButton(android.R.string.cancel,null);
return builder.create();
case DIALOG_SENDLATER_DATE:
Calendar c=Calendar.getInstance();
return new DatePickerDialog(this,this,c.get(Calendar.YEAR),c.get(Calendar.MONTH),c.get(Calendar.DAY_OF_MONTH));
case DIALOG_SENDLATER_TIME:
c=Calendar.getInstance();
return new MyTimePickerDialog(this,this,c.get(Calendar.HOUR_OF_DAY),c.get(Calendar.MINUTE),true);
case DIALOG_EMO:
return this.createEmoticonsDialog();
default :
return null;
}
}
 

Example 60

From project WLANAudit-Android, under directory /WLANAudit/src/es/glasspixel/wlanaudit/activities/.

Source file: NetworkDetailsActivity.java

  19 
vote

private void setupCopyButtonCallback(){
  mCopyButton.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      AlertDialog.Builder dialogBuilder=new Builder(NetworkDetailsActivity.this);
      dialogBuilder.setIcon(android.R.drawable.ic_dialog_alert);
      dialogBuilder.setTitle(getResources().getText(R.string.key_copy_warn_title));
      dialogBuilder.setMessage(getResources().getText(R.string.key_copy_warn_text));
      dialogBuilder.setPositiveButton(R.string.ok_button,new DialogInterface.OnClickListener(){
        @Override public void onClick(        DialogInterface dialog,        int unkn){
          if (mKeyList.size() == 1) {
            ClipboardManager clipBoard=(ClipboardManager)NetworkDetailsActivity.this.getSystemService(CLIPBOARD_SERVICE);
            clipBoard.setText(mDefaultPassValue.getText());
            dialog.dismiss();
            Toast notificationToast=Toast.makeText(NetworkDetailsActivity.this,getResources().getString(R.string.key_copy_success),Toast.LENGTH_SHORT);
            notificationToast.setGravity(Gravity.CENTER,0,0);
            notificationToast.show();
          }
 else           if (mKeyList.size() > 1) {
            Intent i=new Intent(NetworkDetailsActivity.this,KeyListActivity.class);
            i.putStringArrayListExtra(KeyListActivity.KEY_LIST_KEY,(ArrayList<String>)mKeyList);
            startActivity(i);
          }
        }
      }
);
      dialogBuilder.show();
    }
  }
);
}