List of usage examples for android.os Bundle putBundle
public void putBundle(@Nullable String key, @Nullable Bundle value)
From source file:com.firefly.sample.castcompanionlibrary.cast.player.VideoCastControllerFragment.java
/** * Call this static method to create an instance of this fragment. * * @param extras//from w w w . jav a 2 s .co m * @return */ public static VideoCastControllerFragment newInstance(Bundle extras) { VideoCastControllerFragment f = new VideoCastControllerFragment(); Bundle b = new Bundle(); b.putBundle(EXTRAS, extras); f.setArguments(b); return f; }
From source file:com.evollu.react.fcm.BundleJSONConverter.java
public static Bundle convertToBundle(JSONObject jsonObject) throws JSONException { Bundle bundle = new Bundle(); @SuppressWarnings("unchecked") Iterator<String> jsonIterator = jsonObject.keys(); while (jsonIterator.hasNext()) { String key = jsonIterator.next(); Object value = jsonObject.get(key); if (value == null || value == JSONObject.NULL) { // Null is not supported. continue; }//from ww w .j a va 2 s . c o m // Special case JSONObject as it's one way, on the return it would be Bundle. if (value instanceof JSONObject) { bundle.putBundle(key, convertToBundle((JSONObject) value)); continue; } Setter setter = SETTERS.get(value.getClass()); if (setter == null) { throw new IllegalArgumentException("Unsupported type: " + value.getClass()); } setter.setOnBundle(bundle, key, value); } return bundle; }
From source file:com.commonsdroid.fragmentdialog.ViewDialogFragment.java
/** * New instance./*www .j a v a 2s .c o m*/ * * @param ctx the context * @param view the view * @param viewDialogInterface the view dialog interface * @return the view dialog fragment */ public static ViewDialogFragment newInstance(final Builder builder) {//Integer view,ViewDialogListener viewDialogListener,int identifier) { Bundle args = new Bundle(); stateListener = builder.listener; args.putInt(VIEW, builder.view); args.putInt(IDENTIFIER, builder.identifier); args.putBoolean(CANCELABLE, builder.isCancelable); args.putInt(STYLE, builder.style); args.putInt(THEME, builder.theme); args.putBoolean(TITLE_BAR_VISIBLE, builder.isTitleBarVisible); args.putString(TITLE, builder.mTitle); args.putInt(ANIMATION, builder.mAnim); args.putBundle(BUNDLE, builder.bundle); args.putInt(WIDTH, builder.width); args.putInt(HEIGHT, builder.height); args.putInt(MAP, builder.mContainer); ViewDialogFragment frag = new ViewDialogFragment(); frag.setArguments(args); return frag; }
From source file:com.ruesga.rview.fragments.EditDialogFragment.java
public static EditDialogFragment newInstance(String title, String subtitle, String value, String action, String hint, boolean allowEmpty, boolean allowSuggestions, boolean multiLine, View anchor, int requestCode, @Nullable Bundle data) { EditDialogFragment fragment = new EditDialogFragment(); Bundle arguments = new Bundle(); arguments.putString(EXTRA_TITLE, title); if (!TextUtils.isEmpty(subtitle)) { arguments.putString(EXTRA_SUBTITLE, subtitle); }/*from w ww .ja va2 s. c om*/ arguments.putString(EXTRA_VALUE, value); arguments.putString(EXTRA_ACTION, action); arguments.putString(EXTRA_HINT, hint); arguments.putBoolean(EXTRA_ALLOW_EMPTY, allowEmpty); arguments.putBoolean(EXTRA_ALLOW_SUGGESTIONS, allowSuggestions); arguments.putBoolean(EXTRA_USE_MULTI_LINE, multiLine); arguments.putParcelable(EXTRA_ANCHOR, computeViewOnScreen(anchor)); arguments.putInt(EXTRA_REQUEST_CODE, requestCode); if (data != null) { arguments.putBundle(EXTRA_REQUEST_DATA, data); } fragment.setArguments(arguments); return fragment; }
From source file:Main.java
/** * /*w w w . ja va 2 s .c om*/ * @param bundle * @param key * @param object */ private static void putBundleObject(Bundle bundle, String key, Object object) { if (bundle != null && object != null && !TextUtils.isEmpty(key)) { if (object instanceof String) { bundle.putString(key, (String) object); } else if (object instanceof Boolean) { bundle.putBoolean(key, (Boolean) object); } else if (object instanceof Double) { bundle.putDouble(key, (Double) object); } else if (object instanceof Float) { Float value = (Float) object; bundle.putDouble(key, (double) value); } else if (object instanceof Integer) { bundle.putInt(key, (Integer) object); } else if (object instanceof Long) { bundle.putLong(key, (Long) object); } else if (object instanceof JSONObject) { object = parseBundle((JSONObject) object); bundle.putBundle(key, (Bundle) object); } else if (object instanceof JSONArray) { int elementQuantity = ((JSONArray) object).length(); Bundle subBundle = new Bundle(elementQuantity); for (int i = 0; i < elementQuantity; i++) { Object subObject = getArrayValue((JSONArray) object, i, null); if (subObject != null) { putBundleObject(subBundle, key, subObject); } } } } }
From source file:com.google.android.apps.authenticator.dataexport.Exporter.java
private static Bundle getAccountDbBundle(AccountDb accountDb) { List<String> accountNames = new ArrayList<String>(); accountDb.getNames(accountNames);//from w w w .ja v a2s . co m Bundle result = new Bundle(); int accountPosition = 0; for (String accountName : accountNames) { accountPosition++; Bundle account = new Bundle(); account.putString("name", accountName); account.putString("encodedSecret", accountDb.getSecret(accountName)); account.putInt("counter", accountDb.getCounter(accountName)); AccountDb.OtpType accountType = accountDb.getType(accountName); String serializedAccountType; switch (accountType) { case HOTP: serializedAccountType = "hotp"; break; case TOTP: serializedAccountType = "totp"; break; default: throw new RuntimeException("Unsupported account type: " + accountType); } account.putString("type", serializedAccountType); result.putBundle(String.valueOf(accountPosition), account); } return result; }
From source file:com.btmura.android.reddit.app.ComposeFormFragment.java
public static ComposeFormFragment newInstance(int type, String accountName, String subredditDestination, String messageDestination, String title, String text, boolean isReply, Bundle extras) { Bundle args = new Bundle(8); args.putInt(ARG_TYPE, type);/*from www .j a v a 2 s .co m*/ args.putString(ARG_ACCOUNT_NAME, accountName); args.putString(ARG_SUBREDDIT_DESTINATION, subredditDestination); args.putString(ARG_MESSAGE_DESTINATION, messageDestination); args.putString(ARG_TITLE, title); args.putString(ARG_TEXT, text); args.putBoolean(ARG_IS_REPLY, isReply); args.putBundle(ARG_EXTRAS, extras); ComposeFormFragment frag = new ComposeFormFragment(); frag.setArguments(args); return frag; }
From source file:com.dwdesign.tweetings.fragment.LocalActivityManagerFragment.java
@Override public void onSaveInstanceState(final Bundle outState) { super.onSaveInstanceState(outState); outState.putBundle(KEY_STATE_BUNDLE, mLocalActivityManager.saveInstanceState()); }
From source file:com.app.controller.LocalActivityManagerFragment.java
@Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putBundle(KEY_STATE_BUNDLE, mLocalActivityManager.saveInstanceState()); }
From source file:com.example.android.snake.Snake.java
@Override public void onSaveInstanceState(Bundle outState) { //Store the game state outState.putBundle(ICICLE_KEY, mSnakeView.saveState()); }