List of usage examples for android.os PersistableBundle putPersistableBundle
public void putPersistableBundle(@Nullable String key, @Nullable PersistableBundle value)
From source file:Main.java
@TargetApi(Build.VERSION_CODES.LOLLIPOP_MR1) public static PersistableBundle bundleToPersistableBundle(Bundle bundle) { Set<String> keySet = bundle.keySet(); PersistableBundle persistableBundle = new PersistableBundle(); for (String key : keySet) { Object value = bundle.get(key); if (value instanceof Boolean) { persistableBundle.putBoolean(key, (boolean) value); } else if (value instanceof Integer) { persistableBundle.putInt(key, (int) value); } else if (value instanceof String) { persistableBundle.putString(key, (String) value); } else if (value instanceof String[]) { persistableBundle.putStringArray(key, (String[]) value); } else if (value instanceof Bundle) { PersistableBundle innerBundle = bundleToPersistableBundle((Bundle) value); persistableBundle.putPersistableBundle(key, innerBundle); }/*from w w w. j a v a 2 s. c o m*/ } return persistableBundle; }