List of usage examples for android.os Bundle getBooleanArray
@Nullable public boolean[] getBooleanArray(@Nullable String key)
From source file:com.hitkoDev.chemApp.fragment.SectionsFragment.java
@Override public void onCreate(Bundle bundle) { super.onCreate(bundle); //To change body of generated methods, choose Tools | Templates. setRetainInstance(true);//from ww w.ja v a2 s . c o m if (bundle != null) { int[] k = bundle.getIntArray(EXPANDED_KEYS); boolean[] v = bundle.getBooleanArray(EXPANDED_VALUES); if (k != null && v != null) { for (int i = 0; i < k.length && i < v.length; i++) { expanded.put(k[i], v[i]); } } } }
From source file:com.sftoolworks.nfcoptions.SelectActivity.java
@Override public void onRestoreInstanceState(Bundle savedInstanceState) { super.onRestoreInstanceState(savedInstanceState); ListView list = (ListView) findViewById(R.id.listView1); if (list.getCount() == 0) return;//from w w w . j av a 2 s . co m if (savedInstanceState.containsKey(CHECKBOX_STATE)) { boolean[] checkboxes = savedInstanceState.getBooleanArray(CHECKBOX_STATE); ((OptionListAdapter) (list.getAdapter())).restoreCheckState(checkboxes); } if (savedInstanceState.containsKey(KEY_STATE)) { selectKey = savedInstanceState.getString(KEY_STATE); } }
From source file:mchs.neverforget.NeverForgetActivity.java
@Override protected void onRestoreInstanceState(Bundle savedInstanceState) { super.onRestoreInstanceState(savedInstanceState); isBookSelected = savedInstanceState.getBooleanArray(SELECTED_BOOKS); populateBooksList(false); /* False tells that it isn't first login */ }
From source file:com.dnielfe.manager.AppManager.java
@Override protected void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_appmanager); pm = getPackageManager();//from www .j ava 2 s . c o m mActionBar = getActionBar(); init(); if (savedInstanceState != null) { mStarStates = savedInstanceState.getBooleanArray(STAR_STATES); } else { mStarStates = new boolean[mAppList.size()]; } }
From source file:com.billooms.harppedals.chords.ChordFragment.java
/** * Restore the state of this fragment from the given savedInstanceState. * * @param bundle savedInstanceState//from ww w . j a v a 2 s . c om */ private void restoreInstanceState(Bundle bundle) { if (bundle == null) { return; } int[] chordArray = bundle.getIntArray(ARG_CHORD); if ((chordArray != null) && (chordArray.length == 3)) { rootSpinner.setSelection(chordArray[0]); sharpFlatSpinner.setSelection(chordArray[1]); triadSpinner.setSelection(chordArray[2]); } boolean[] chordAddArray = bundle.getBooleanArray(ARG_CHORDADD); if ((chordAddArray != null) && (chordAddArray.length == 4)) { add2Button.setChecked(chordAddArray[0]); add4Button.setChecked(chordAddArray[1]); sus4Button.setChecked(chordAddArray[2]); add6Button.setChecked(chordAddArray[3]); } }
From source file:uk.org.rivernile.edinburghbustracker.android.fragments.dialogs.ServicesChooserDialogFragment.java
/** * {@inheritDoc}/*from www . ja v a 2 s. c o m*/ */ @Override public void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); final Bundle args = getArguments(); services = args.getStringArray(ARG_SERVICES); // Do sanity checks. if (services == null || services.length == 0) { throw new IllegalArgumentException("A list of services must " + "be supplied."); } if (savedInstanceState != null) { // If there is a previous instance, get the args from the saved // instance state. checkBoxes = savedInstanceState.getBooleanArray(ARG_CHECK_BOXES); } else { final String[] selectedServices = args.getStringArray(ARG_SELECTED_SERVICES); checkBoxes = new boolean[services.length]; if (selectedServices != null && selectedServices.length > 0) { int i; final int len = services.length; for (i = 0; i < len; i++) { for (String s : selectedServices) { if (services[i].equals(s)) { checkBoxes[i] = true; break; } } } } } }
From source file:at.wada811.android.dialogfragments.AlertDialogFragment.java
private void setMultiChoiceItems(AlertDialog.Builder builder) { final Bundle args = getArguments(); final CharSequence[] items = args.getCharSequenceArray(MULTI_CHOICE_ITEMS); final boolean[] checked = args.getBooleanArray(CHECKED_ITEMS); if (items == null || checked == null) { return;//from www . j a v a2 s . co m } if (items.length != checked.length) { throw new IllegalArgumentException("Item's length is not same as checkedItem's length."); } builder.setMultiChoiceItems(items, checked, new DialogInterface.OnMultiChoiceClickListener() { @Override public void onClick(DialogInterface dialog, int which, boolean isChecked) { bindMultiChoiceClickListener(which, isChecked); } }); }
From source file:com.androidaq.AndroiDAQMain.java
private void saveMyPreferences() { //Log.e(TAG, "Save Preferences Fired"); Context context = getApplicationContext(); Bundle myBundle = ((AndroiDAQAdapter) pager.getAdapter()).getUIStates(); boolean[] isOutputCh = myBundle.getBooleanArray("isInput"); boolean[] isDigCh = myBundle.getBooleanArray("isDig"); boolean[] outputState = myBundle.getBooleanArray("outputState"); String[] desiredFreq = myBundle.getStringArray("desiredFreqs"); String[] desiredDuty = myBundle.getStringArray("desiredDutys"); saveBooleanArray(isOutputCh, "isInput", context); saveBooleanArray(isDigCh, "isDig", context); saveBooleanArray(outputState, "outputState", context); saveStringArray(desiredFreq, "desiredFreqs", context); saveStringArray(desiredDuty, "desiredDutys", context); /*Example//from w w w .j av a2s . c o m mEditor.putInt("setTime", countSecs); mEditor.putBoolean("timeSet", timeIsSet); mEditor.putString("project", project); mEditor.commit(); */ }
From source file:com.androidaq.AndroiDAQTCPMain.java
private void saveMyPreferences() { //Log.e(TAG, "Save Preferences Fired"); Context context = getApplicationContext(); Bundle myBundle = ((AndroiDAQTCPAdapter) pager.getAdapter()).getUIStates(); boolean[] isOutputCh = myBundle.getBooleanArray("isInput"); boolean[] isDigCh = myBundle.getBooleanArray("isDig"); boolean[] outputState = myBundle.getBooleanArray("outputState"); String[] desiredFreq = myBundle.getStringArray("desiredFreqs"); String[] desiredDuty = myBundle.getStringArray("desiredDutys"); saveBooleanArray(isOutputCh, "isInput", context); saveBooleanArray(isDigCh, "isDig", context); saveBooleanArray(outputState, "outputState", context); saveStringArray(desiredFreq, "desiredFreqs", context); saveStringArray(desiredDuty, "desiredDutys", context); /*Example// w w w . ja va 2 s.c o m mEditor.putInt("setTime", countSecs); mEditor.putBoolean("timeSet", timeIsSet); mEditor.putString("project", project); mEditor.commit(); */ }
From source file:com.fenlisproject.elf.core.framework.ElfBinder.java
public static void bindFragmentArgument(Fragment receiver) { Field[] fields = receiver.getClass().getDeclaredFields(); for (Field field : fields) { field.setAccessible(true);/*from w w w . j av a 2 s . c o m*/ FragmentArgument fragmentArgument = field.getAnnotation(FragmentArgument.class); if (fragmentArgument != null) { try { Bundle bundle = receiver.getArguments(); if (bundle != null) { Class<?> type = field.getType(); if (type == Boolean.class || type == boolean.class) { field.set(receiver, bundle.getBoolean(fragmentArgument.value())); } else if (type == Byte.class || type == byte.class) { field.set(receiver, bundle.getByte(fragmentArgument.value())); } else if (type == Character.class || type == char.class) { field.set(receiver, bundle.getChar(fragmentArgument.value())); } else if (type == Double.class || type == double.class) { field.set(receiver, bundle.getDouble(fragmentArgument.value())); } else if (type == Float.class || type == float.class) { field.set(receiver, bundle.getFloat(fragmentArgument.value())); } else if (type == Integer.class || type == int.class) { field.set(receiver, bundle.getInt(fragmentArgument.value())); } else if (type == Long.class || type == long.class) { field.set(receiver, bundle.getLong(fragmentArgument.value())); } else if (type == Short.class || type == short.class) { field.set(receiver, bundle.getShort(fragmentArgument.value())); } else if (type == String.class) { field.set(receiver, bundle.getString(fragmentArgument.value())); } else if (type == Boolean[].class || type == boolean[].class) { field.set(receiver, bundle.getBooleanArray(fragmentArgument.value())); } else if (type == Byte[].class || type == byte[].class) { field.set(receiver, bundle.getByteArray(fragmentArgument.value())); } else if (type == Character[].class || type == char[].class) { field.set(receiver, bundle.getCharArray(fragmentArgument.value())); } else if (type == Double[].class || type == double[].class) { field.set(receiver, bundle.getDoubleArray(fragmentArgument.value())); } else if (type == Float[].class || type == float[].class) { field.set(receiver, bundle.getFloatArray(fragmentArgument.value())); } else if (type == Integer[].class || type == int[].class) { field.set(receiver, bundle.getIntArray(fragmentArgument.value())); } else if (type == Long[].class || type == long[].class) { field.set(receiver, bundle.getLongArray(fragmentArgument.value())); } else if (type == Short[].class || type == short[].class) { field.set(receiver, bundle.getShortArray(fragmentArgument.value())); } else if (type == String[].class) { field.set(receiver, bundle.getStringArray(fragmentArgument.value())); } else if (Serializable.class.isAssignableFrom(type)) { field.set(receiver, bundle.getSerializable(fragmentArgument.value())); } else if (type == Bundle.class) { field.set(receiver, bundle.getBundle(fragmentArgument.value())); } } } catch (IllegalAccessException e) { e.printStackTrace(); } } } }