List of usage examples for android.os Bundle getIntArray
@Nullable public int[] getIntArray(@Nullable String key)
From source file:org.deviceconnect.android.deviceplugin.hvcc2w.setting.fragment.HVCC2WPairingFragment.java
/** Check Permission. */ private void checkPermission() { // WiFi scan requires location permissions. if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP + 1) { if (PermissionChecker.checkSelfPermission(getContext(), Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED && PermissionChecker.checkSelfPermission(getContext(), Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) { searchWifi();//w w w . ja v a 2s. co m } else { PermissionRequestActivity.requestPermissions(getContext(), new String[] { Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION }, new ResultReceiver(new Handler(Looper.getMainLooper())) { @Override protected void onReceiveResult(final int resultCode, final Bundle resultData) { String[] retPermissions = resultData.getStringArray("EXTRA_PERMISSIONS"); int[] retGrantResults = resultData.getIntArray("EXTRA_GRANT_RESULTS"); if (retPermissions == null || retGrantResults == null) { HVCC2WDialogFragment.showAlert(getActivity(), getString(R.string.hw_name), "WiFi scan aborted.", null); return; } for (int i = 0; i < retPermissions.length; ++i) { if (retGrantResults[i] == PackageManager.PERMISSION_DENIED) { HVCC2WDialogFragment.showAlert(getActivity(), getString(R.string.hw_name), "WiFi scan aborted.", null); return; } } searchWifi(); } }); } } }
From source file:androidx.navigation.fragment.FragmentNavigator.java
@Override public void onRestoreState(@Nullable Bundle savedState) { if (savedState != null) { int[] backStack = savedState.getIntArray(KEY_BACK_STACK_IDS); if (backStack != null) { for (int destId : backStack) { mBackStack.add(destId);// w ww.ja va2s .c om } } } }
From source file:com.gawdl3y.android.tasktimer.adapters.NewFragmentStatePagerAdapter.java
@Override public void restoreState(Parcelable state, ClassLoader loader) { if (state != null) { Bundle bundle = (Bundle) state; bundle.setClassLoader(loader);/*from w w w. ja v a 2s . co m*/ mItemIds = bundle.getIntArray("itemids"); if (mItemIds == null) { mItemIds = new int[] {}; } Parcelable[] fss = bundle.getParcelableArray("states"); mSavedState.clear(); mFragments.clear(); if (fss != null) { for (int i = 0; i < fss.length; i++) { mSavedState.add((Fragment.SavedState) fss[i]); } } Iterable<String> keys = bundle.keySet(); for (String key : keys) { if (key.startsWith("f")) { int index = Integer.parseInt(key.substring(1)); Fragment f = mFragmentManager.getFragment(bundle, key); if (f != null) { while (mFragments.size() <= index) { mFragments.add(null); } f.setMenuVisibility(false); mFragments.set(index, f); } else { Log.w(TAG, "Bad fragment at key " + key); } } } } }
From source file:com.github.michalbednarski.intentslab.valueeditors.framework.ChildFragmentWorkaround.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); if (savedInstanceState != null) { FragmentManager topFragmentManager = getFragmentManager(); for (int key : savedInstanceState.getIntArray(STATE_KEYS)) { mDeliverInfos.put(key,/*from ww w.ja v a 2s.com*/ new DeliverResultInfo( getChildFragmentFromBundle(topFragmentManager, savedInstanceState, STATE_PREFIX_FRAGMENT + key), savedInstanceState.getInt(STATE_PREFIX_CODE + key))); } mNextNewResultCode = savedInstanceState.getInt(STATE_NEXT_CODE); } }
From source file:org.kontalk.ui.adapter.ContactsListAdapter.java
private void updateIndexer(Cursor cursor) { if (cursor == null) { setSectionIndexer(null);/*from ww w .j a v a2 s .c o m*/ return; } Bundle bundle = cursor.getExtras(); if (bundle.containsKey(MyUsers.Users.EXTRA_INDEX_TITLES) && bundle.containsKey(MyUsers.Users.EXTRA_INDEX_COUNTS)) { String sections[] = bundle.getStringArray(MyUsers.Users.EXTRA_INDEX_TITLES); int counts[] = bundle.getIntArray(MyUsers.Users.EXTRA_INDEX_COUNTS); setSectionIndexer(new ContactsSectionIndexer(sections, counts)); } else { setSectionIndexer(null); } }
From source file:com.zns.comicdroid.BaseListFragment.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Bundle args = getArguments();/*from w w w. j a v a2 s. c o m*/ if (args != null) { mIndex = args.getInt("index"); } if (savedInstanceState != null) { mScrollPos = savedInstanceState.getIntArray(STATE_SCROLLY); mFilter = savedInstanceState.getString(STATE_FILTER); } }
From source file:com.philliphsu.bottomsheetpickers.date.PagingMonthAdapter.java
@Override public void restoreState(Parcelable state, ClassLoader loader) { if (state != null) { Bundle bundle = (Bundle) state; bundle.setClassLoader(loader);/*from w ww . j a v a 2 s. com*/ String[] titles = bundle.getStringArray(KEY_MONTH_YEAR_TITLES); int[] positions = bundle.getIntArray(KEY_POSITIONS); mMonthYearTitles.clear(); if (titles != null && positions != null) { // Both arrays should be the same size, so use either length. for (int i = 0; i < titles.length; i++) { mMonthYearTitles.append(positions[i], titles[i]); } } } }
From source file:com.billooms.harppedals.HarpPedalsActivity.java
@Override protected void onRestoreInstanceState(Bundle savedInstanceState) { // Log.d(TAG, "HarpPedalsActivity.onRestoreInstanceState"); super.onRestoreInstanceState(savedInstanceState); savedChordArray = savedInstanceState.getIntArray(ARG_CHORD); savedChordAddArray = savedInstanceState.getBooleanArray(ARG_CHORDADD); savedKey = new Key( KeySignature.values()[savedInstanceState.getInt(ARG_KEY, KeySignature.DEFAULT.ordinal())], Scale.values()[savedInstanceState.getInt(ARG_SCALE, Scale.DEFAULT.ordinal())]); }
From source file:com.billooms.harppedals.chords.ChordFragment.java
/** * Restore the state of this fragment from the given savedInstanceState. * * @param bundle savedInstanceState/* w w w . ja v a 2s .c o m*/ */ 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: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 w ww . ja v a 2 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]); } } } }