List of usage examples for android.os Bundle putBundle
public void putBundle(@Nullable String key, @Nullable Bundle value)
From source file:edu.cmu.android.restaurant.MapFragment.java
@Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putBundle(TAG, mLocalActivityManager.saveInstanceState()); }
From source file:com.pinkwerther.support.PinkwertherSupport.java
@Override public void onSaveInstanceState(Bundle bundle) { if (mSubBundles.size() > 0) { for (int i = 0; i < mSubBundles.size(); i++) { bundle.putBundle(PW_SUB_BUNDLE + i, mSubBundles.get(i)); }/*from ww w . j a va 2 s . c o m*/ } if (mRM != null) bundle.putBundle(RM_BUNDLE, mRM.getRecreationArguments()); if (mLicense != null) bundle.putBundle(LICENSE_BUNDLE, mLicense.getRecreationArguments()); if (mAds != null) bundle.putBundle(ADS_BUNDLE, mAds.getRecreationArguments()); super.onSaveInstanceState(bundle); }
From source file:org.apache.cordova.CordovaInterfaceImpl.java
/** * Saves parameters for startActivityForResult(). *//*from w ww. j av a 2 s . c om*/ public void onSaveInstanceState(Bundle outState) { if (activityResultCallback != null) { String serviceName = activityResultCallback.getServiceName(); outState.putString("callbackService", serviceName); } outState.putBundle("plugin", pluginManager.onSaveInstanceState()); }
From source file:androidx.navigation.fragment.NavHostFragment.java
@Override public void onSaveInstanceState(@NonNull Bundle outState) { super.onSaveInstanceState(outState); Bundle navState = mNavController.saveState(); if (navState != null) { outState.putBundle(KEY_NAV_CONTROLLER_STATE, navState); }/*from w w w . j a va 2 s .co m*/ if (mDefaultNavHost) { outState.putBoolean(KEY_DEFAULT_NAV_HOST, true); } }
From source file:com.cnm.cnmrc.fragment.vodtvch.VodSemi.java
/** * vod (1st arg : 2nd arg) : (0:) / (1:?) / (2:TV) / (3:) *//*from w ww .j ava 2 s. com*/ public VodSemi newInstance(int selectedCategory, String title, boolean isFirstDepth, Bundle bundle) { VodSemi f = new VodSemi(); Bundle args = new Bundle(); args.putInt("selectedCategory", selectedCategory); args.putString("title", title); args.putBoolean("isFirstDepth", isFirstDepth); args.putBundle("bundle", bundle); f.setArguments(args); return f; }
From source file:com.google.android.gcm.demo.ui.GroupActivity.java
@Override public void onSaveInstanceState(Bundle savedState) { savedState.putBundle(STATE_NEW_MEMBERS, newMembers); savedState.putBundle(STATE_REMOVED_MEMBERS, removedMembers); savedState.putString(STATE_SELECTED_SENDER_ID, sender.senderId); savedState.putString(STATE_SELECTED_API_KEY, senderApiKey); savedState.putString(STATE_SELECTED_GROUP_NAME, group.notificationKeyName); }
From source file:com.facebook.samples.AdUnitsSample.InstreamVideoFragment.java
@Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); if (instreamVideoAdView == null) { return;/*from ww w .j a v a2s. c o m*/ } Bundle adState = instreamVideoAdView.getSaveInstanceState(); if (adState != null) { outState.putBundle(AD, adState); } }
From source file:org.mariotaku.twidere.fragment.DMConversationFragment.java
@Override public void onSaveInstanceState(Bundle outState) { outState.putString(INTENT_KEY_TEXT, String.valueOf(mEditText.getText())); outState.putBundle(INTENT_KEY_DATA, mArguments); super.onSaveInstanceState(outState); }
From source file:com.facebook.internal.BundleJSONConverterTests.java
@SmallTest public void testSimpleValues() throws JSONException { ArrayList<String> arrayList = new ArrayList<String>(); arrayList.add("1st"); arrayList.add("2nd"); arrayList.add("third"); Bundle innerBundle1 = new Bundle(); innerBundle1.putInt("inner", 1); Bundle innerBundle2 = new Bundle(); innerBundle2.putString("inner", "2"); innerBundle2.putStringArray("deep list", new String[] { "7", "8" }); innerBundle1.putBundle("nested bundle", innerBundle2); Bundle b = new Bundle(); b.putBoolean("boolValue", true); b.putInt("intValue", 7); b.putLong("longValue", 5000000000l); b.putDouble("doubleValue", 3.14); b.putString("stringValue", "hello world"); b.putStringArray("stringArrayValue", new String[] { "first", "second" }); b.putStringArrayList("stringArrayListValue", arrayList); b.putBundle("nested", innerBundle1); JSONObject json = BundleJSONConverter.convertToJSON(b); assertNotNull(json);// w w w .ja v a 2s . c o m assertEquals(true, json.getBoolean("boolValue")); assertEquals(7, json.getInt("intValue")); assertEquals(5000000000l, json.getLong("longValue")); assertEquals(3.14, json.getDouble("doubleValue")); assertEquals("hello world", json.getString("stringValue")); JSONArray jsonArray = json.getJSONArray("stringArrayValue"); assertEquals(2, jsonArray.length()); assertEquals("first", jsonArray.getString(0)); assertEquals("second", jsonArray.getString(1)); jsonArray = json.getJSONArray("stringArrayListValue"); assertEquals(3, jsonArray.length()); assertEquals("1st", jsonArray.getString(0)); assertEquals("2nd", jsonArray.getString(1)); assertEquals("third", jsonArray.getString(2)); JSONObject innerJson = json.getJSONObject("nested"); assertEquals(1, innerJson.getInt("inner")); innerJson = innerJson.getJSONObject("nested bundle"); assertEquals("2", innerJson.getString("inner")); jsonArray = innerJson.getJSONArray("deep list"); assertEquals(2, jsonArray.length()); assertEquals("7", jsonArray.getString(0)); assertEquals("8", jsonArray.getString(1)); Bundle finalBundle = BundleJSONConverter.convertToBundle(json); assertNotNull(finalBundle); assertEquals(true, finalBundle.getBoolean("boolValue")); assertEquals(7, finalBundle.getInt("intValue")); assertEquals(5000000000l, finalBundle.getLong("longValue")); assertEquals(3.14, finalBundle.getDouble("doubleValue")); assertEquals("hello world", finalBundle.getString("stringValue")); List<String> stringList = finalBundle.getStringArrayList("stringArrayValue"); assertEquals(2, stringList.size()); assertEquals("first", stringList.get(0)); assertEquals("second", stringList.get(1)); stringList = finalBundle.getStringArrayList("stringArrayListValue"); assertEquals(3, stringList.size()); assertEquals("1st", stringList.get(0)); assertEquals("2nd", stringList.get(1)); assertEquals("third", stringList.get(2)); Bundle finalInnerBundle = finalBundle.getBundle("nested"); assertEquals(1, finalInnerBundle.getInt("inner")); finalBundle = finalInnerBundle.getBundle("nested bundle"); assertEquals("2", finalBundle.getString("inner")); stringList = finalBundle.getStringArrayList("deep list"); assertEquals(2, stringList.size()); assertEquals("7", stringList.get(0)); assertEquals("8", stringList.get(1)); }
From source file:de.sourcestream.movieDB.controller.GalleryList.java
/** * Called to ask the fragment to save its current dynamic state, * so it can later be reconstructed in a new instance of its process is restarted. * * @param outState Bundle in which to place your saved state. */// w w w .j ava 2s . com @Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); // Used to avoid bug where we add item in the back stack // and if we change orientation twice the item from the back stack has null values if (save != null) outState.putBundle("save", save); else { Bundle send = new Bundle(); send.putString("title", getTitle()); outState.putBundle("save", send); } }