AlertDialog.Builder setMultiChoiceItems - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for AlertDialog.Builder setMultiChoiceItems method.

This code example shows how to use the following methods:create, setMultiChoiceItems, setPositiveButton, setTitle
	} 
	 
	 
	private Dialog createCategoryDialog()
	{ 
		AlertDialog.Builder builder=new AlertDialog.Builder(this);
		builder.setTitle("Select Categories");
		builder.setMultiChoiceItems(categoryStrings, clickedCategories, new OnMultiChoiceClickListener(){
			@Override 
			public void onClick(DialogInterface dialog, int which, boolean isChecked) {
				clickedCategories[which]=isChecked;
			} 
		}); 
		builder.setPositiveButton("OK", new Dialog.OnClickListener(){
			@Override 
			public void onClick(DialogInterface dialog, int which) {
				setCategories(); 
				dialog.dismiss();
			} 
		}); 

6
CodeRank
This code example shows how to use the following methods:setMultiChoiceItems
	} 
 
	@Override 
	protected void onPrepareDialogBuilder(final Builder builder) {
		if (this.m) {
			builder.setMultiChoiceItems(this.getEntries(), this.checked,
					new DialogInterface.OnMultiChoiceClickListener() {
						public void onClick(final DialogInterface dialog, final int which,
								final boolean val) {
							CVListPreference.this.checked[which] = val;
						} 
					}); 
		} else { 
			super.onPrepareDialogBuilder(builder);
		} 
	} 
 
	@Override 
	protected View onCreateView(final ViewGroup parent) {
		View v = super.onCreateView(parent);
5
CodeRank
This code example shows how to use the following methods:create, setMultiChoiceItems, setPositiveButton
    } 
  } 
 
  public Dialog onCreateDialog(Bundle paramBundle)
  { 
    AlertDialog.Builder localBuilder = new AlertDialog.Builder(al.d(getActivity()));
    localBuilder.setMultiChoiceItems(this.a, this.b, new s(this));
    localBuilder.setPositiveButton(2131492965, new t(this));
    AlertDialog localAlertDialog = localBuilder.create();
    localAlertDialog.setInverseBackgroundForced(true);
    return localAlertDialog;
  } 
 
  public void onSaveInstanceState(Bundle paramBundle)
  { 
    super.onSaveInstanceState(paramBundle);
    paramBundle.putStringArray("mEntriesNames", this.a);
    paramBundle.putBooleanArray("mSelected", this.b);
  } 
} 
7
CodeRank
This code example shows how to use the following methods:setMultiChoiceItems, setOnCancelListener, setPositiveButton, show
    		 lekplatsclass.setspinnerisshowing();
    	 } 
    	  
    	 Log.i("samhall","multispinner performclick");
    	 Builder dialog = new AlertDialog.Builder(getContext());
         AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
    
         builder.setMultiChoiceItems(
                   listitems.toArray(new CharSequence[listitems.size()]), checked, this);
         builder.setPositiveButton("klar",
                 new DialogInterface.OnClickListener()
         { 
 
             @Override 
             public void onClick(DialogInterface dialog, int which)
             { 
                 dialog.cancel();
             } 
         }); 
         builder.setOnCancelListener(this);

6
CodeRank
This code example shows how to use the following methods:setMultiChoiceItems, setNegativeButton, setPositiveButton, setTitle, show
        return true; 
    } 
     
   
    private void AppListDialog() { 
    	Builder alertDialog = new AlertDialog.Builder(getActivity());
    	alertDialog.setTitle("Theme Presets");
    	alertDialog.setNegativeButton("Cancel", null);
    	alertDialog.setPositiveButton("Select", null);
    	final Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
    	mainIntent.addCategory(Intent.CATEGORY_LAUNCHER);
 
    	List<String> listItems = getAppNames(false);
 
 
 
    	final CharSequence[] cs = listItems.toArray(new CharSequence[listItems.size()]);
    	alertDialog.setMultiChoiceItems(cs, null, null);
    	alertDialog.show();
    	 

5
CodeRank
This code example shows how to use the following methods:setMultiChoiceItems
            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) {
						String entryValue = getEntryValues()[which] + ",";
						if (val){
							resultentries += entryValue;
						} else { 
							resultentries = resultentries.replace(entryValue, "");
						} 
                    	mClickedDialogEntryIndices[which] = val;
					} 
        }); 
    } 
 
    public static String[] parseStoredValue(CharSequence val) {
4
CodeRank
This code example shows how to use the following methods:setMultiChoiceItems
            throw new IllegalStateException(
                    "ListPreference requires an entries array and an entryValues array which are both the same length"); 
        } 
 
        restoreCheckedEntries(entryValues);
        builder.setMultiChoiceItems(entries, mClickedDialogEntryIndices,
                new DialogInterface.OnMultiChoiceClickListener() {
					public void onClick(DialogInterface dialog, int which, boolean val) {
                    	mClickedDialogEntryIndices[which] = val;
					} 
        }); 
    } 
 
    private void restoreCheckedEntries(CharSequence[] entryValues) {
    	if (entryValues != null ) {
            for(int i=0; i<entryValues.length;i++){
                //set the corresponding boolean 
                if(!AppConstants.KEYWORD_SELECTED.equals(entryValues[i].toString().trim())){
                    mClickedDialogEntryIndices[i]=false;
                }else{ 
4
CodeRank
This code example shows how to use the following methods:setMultiChoiceItems
            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;
					} 
        }); 
    } 
 
    public static String[] parseStoredValue(CharSequence val) {
		if ( "".equals(val) )
			return null; 
		else 
			return ((String)val).split(SEPARATOR);
    } 
 
4
CodeRank
This code example shows how to use the following methods:setMultiChoiceItems
        CharSequence[] entries = getEntries();
        @SuppressWarnings("unused") 
		CharSequence[] entryValues = getEntryValues();
         
         
        builder.setMultiChoiceItems(
                entries, mDaysOfWeek.getBooleanArray(),
                new DialogInterface.OnMultiChoiceClickListener() {
                    public void onClick(DialogInterface dialog, int which,
                            boolean isChecked) {
                        mNewDaysOfWeek.set(which, isChecked);
                    } 
                }); 
    } 
 
    public void setDaysOfWeek(Alarm.DaysOfWeek dow) {
        mDaysOfWeek.set(dow);
        mNewDaysOfWeek.set(dow);
        setSummary(dow.toString(getContext(), true));
    } 
4
CodeRank
This code example shows how to use the following methods:setMultiChoiceItems
    @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);
                    } 
                }); 
    } 
 
    public void setDaysOfWeek(Alarm.DaysOfWeek dow) {
        mDaysOfWeek.set(dow);
        mNewDaysOfWeek.set(dow);
        setSummary(dow.toString(getContext(), true));
    } 
4
CodeRank

Related AlertDialog.Builder setMultiChoiceItems Questions & Answers:

setMultiChoiceItems Method Overview
Set a list of items to be displayed in the dialog as the content, you will be notified of the selected item via the supplied listener.
See Code Examples for other Android AlertDialog.Builder Methods: