List of usage examples for android.os Bundle putInt
public void putInt(@Nullable String key, int value)
From source file:com.mifos.mifosxdroid.online.ClientChargeFragment.java
public static ClientChargeFragment newInstance(int clientId, List<Charges> chargesList, boolean isParentFragmentAGroupFragment) { ClientChargeFragment fragment = new ClientChargeFragment(); Bundle args = new Bundle(); args.putInt(Constants.CLIENT_ID, clientId); fragment.setArguments(args);/*from w ww . j a va2s . c om*/ fragment.setChargesList(chargesList); if (isParentFragmentAGroupFragment) { fragment.setInfiniteScrollEnabled(false); } return fragment; }
From source file:Main.java
public static Bundle hashtableToBundle(Hashtable table) { Bundle bundle = new Bundle(); Iterator iterator = table.keySet().iterator(); String key;// w w w . j a va2 s . com Object val; while (iterator.hasNext()) { key = (String) iterator.next(); val = table.get(key); if (val instanceof Integer) { bundle.putInt(key, (Integer) val); } else if (val instanceof String) { bundle.putString(key, (String) val); } } return bundle; }
From source file:Main.java
@TargetApi(Build.VERSION_CODES.LOLLIPOP_MR1) public static Bundle persistableBundleToBundle(PersistableBundle persistableBundle) { Set<String> keySet = persistableBundle.keySet(); Bundle bundle = new Bundle(); for (String key : keySet) { Object value = persistableBundle.get(key); if (value instanceof Boolean) { bundle.putBoolean(key, (boolean) value); } else if (value instanceof Integer) { bundle.putInt(key, (int) value); } else if (value instanceof String) { bundle.putString(key, (String) value); } else if (value instanceof String[]) { bundle.putStringArray(key, (String[]) value); } else if (value instanceof PersistableBundle) { Bundle innerBundle = persistableBundleToBundle((PersistableBundle) value); bundle.putBundle(key, innerBundle); }//from www . j av a2 s. com } return bundle; }
From source file:com.ronnyml.sweetplayer.fragments.SearchFragment.java
public static SearchFragment newInstance(int position, String screen) { SearchFragment fragment = new SearchFragment(); Bundle args = new Bundle(); args.putInt(Constants.POSITION, position); args.putString(Constants.SCREEN, screen); fragment.setArguments(args);// w w w. jav a2 s. c o m return fragment; }
From source file:com.seregil13.literarytracker.lightnovel.LightNovelEditFragment.java
/** * Creates a new instance of the fragment in edit mode with all the pertinent data passed in as * parameters.//from w ww. ja v a 2s. co m * * @return An instance of LightNovelEditFragment. */ public static LightNovelEditFragment newEditInstance(int id, String title, String author, String description, String completed, String translatorSite, ArrayList<String> genres) { LightNovelEditFragment fragment = new LightNovelEditFragment(); Bundle arguments = new Bundle(); arguments.putInt(JsonKeys.ID.toString(), id); arguments.putString(JsonKeys.TITLE.toString(), title); arguments.putString(JsonKeys.AUTHOR.toString(), author); arguments.putString(JsonKeys.DESCRIPTION.toString(), description); arguments.putString(JsonKeys.COMPLETED.toString(), completed); arguments.putString(JsonKeys.TRANSLATOR_SITE.toString(), translatorSite); arguments.putStringArrayList(JsonKeys.GENRES.toString(), genres); arguments.putSerializable(CREATE_OR_EDIT_KEY, Mode.EDIT); fragment.setArguments(arguments); return fragment; }
From source file:com.ronnyml.sweetplayer.fragments.ExploreFragment.java
public static ExploreFragment newInstance(int position, String screen) { ExploreFragment fragment = new ExploreFragment(); Bundle args = new Bundle(); args.putInt(Constants.POSITION, position); args.putString(Constants.SCREEN, screen); fragment.setArguments(args);//from ww w . jav a 2s. c om return fragment; }
From source file:com.facebook.internal.ServerProtocol.java
public static Bundle getQueryParamsForPlatformActivityIntentWebFallback(Context context, String callId, int version, String applicationName, Bundle methodArgs) { String keyHash = Settings.getApplicationSignature(context); if (Utility.isNullOrEmpty(keyHash)) { return null; }//from ww w . j a va 2s. c o m Bundle webParams = new Bundle(); webParams.putString(FALLBACK_DIALOG_PARAM_KEY_HASH, keyHash); webParams.putString(FALLBACK_DIALOG_PARAM_APP_ID, Settings.getApplicationId()); webParams.putInt(FALLBACK_DIALOG_PARAM_VERSION, version); webParams.putString(DIALOG_PARAM_DISPLAY, FALLBACK_DIALOG_DISPLAY_VALUE_TOUCH); Bundle bridgeArguments = new Bundle(); bridgeArguments.putString(NativeProtocol.BRIDGE_ARG_ACTION_ID_STRING, callId); bridgeArguments.putString(NativeProtocol.BRIDGE_ARG_APP_NAME_STRING, applicationName); methodArgs = (methodArgs == null) ? new Bundle() : methodArgs; try { JSONObject bridgeArgsJSON = BundleJSONConverter.convertToJSON(bridgeArguments); JSONObject methodArgsJSON = BundleJSONConverter.convertToJSON(methodArgs); if (bridgeArgsJSON == null || methodArgsJSON == null) { return null; } webParams.putString(FALLBACK_DIALOG_PARAM_BRIDGE_ARGS, bridgeArgsJSON.toString()); webParams.putString(FALLBACK_DIALOG_PARAM_METHOD_ARGS, methodArgsJSON.toString()); } catch (JSONException je) { webParams = null; Logger.log(LoggingBehavior.DEVELOPER_ERRORS, Log.ERROR, TAG, "Error creating Url -- " + je); } return webParams; }
From source file:com.ferasinfotech.gwreader.ScreenSlidePageFragment.java
/** * Alternate Factory method for this fragment class. Constructs a new fragment for the given page number, * with page title given as a string parameter without a JSON object containing details. * (used to construct and empty page when a JSON parsing error of a story occurs) *//*from w ww. j a v a 2 s. co m*/ public static ScreenSlidePageFragment create(int pageNumber, int numPages, String story_title) { ScreenSlidePageFragment fragment = new ScreenSlidePageFragment(); Bundle args = new Bundle(); args.putInt(ARG_PAGE, pageNumber); args.putInt(ARG_STORY_ID, 0); args.putString(ARG_TITLE, story_title + " (" + (pageNumber + 1) + "/" + numPages + ")"); args.putString(ARG_SUMMARY, ""); args.putString(ARG_HEADLINE, ""); args.putString(ARG_COVER_PHOTO, ""); args.putString(ARG_STORY_STRING, ""); fragment.setArguments(args); return fragment; }
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 ww w . ja v a2 s . 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:fr.cph.chicago.fragment.BikeFragment.java
/** * Returns a new instance of this fragment for the given section number. * // w w w . j a v a2 s.co m * @param sectionNumber * the section number * @return the fragment */ public static BikeFragment newInstance(final int sectionNumber) { BikeFragment fragment = new BikeFragment(); Bundle args = new Bundle(); args.putInt(ARG_SECTION_NUMBER, sectionNumber); fragment.setArguments(args); return fragment; }