List of usage examples for android.os Bundle putString
public void putString(@Nullable String key, @Nullable String value)
From source file:Main.java
private static void putString(final Bundle bundle, final String token, final String key) { if (bundle != null) { bundle.putString(key, token); }/*from www. j av a2 s. c o m*/ }
From source file:Main.java
public static void addIfNotEmpty(Bundle b, String key, String value) { if (!TextUtils.isEmpty(value)) { b.putString(key, value); }//from w w w . j a v a 2 s . c o m }
From source file:Main.java
public static void goToActivity(Context packageContext, Class<?> targetActivityClass, String paraName, Object paramValue) {// w w w.j ava 2 s .co m Intent intent = new Intent(); intent.setClass(packageContext, targetActivityClass); Bundle bundle = new Bundle(); if (paramValue instanceof String) { bundle.putString(paraName, (String) paramValue); } else { bundle.putInt(paraName, (int) paramValue); } intent.putExtras(bundle); packageContext.startActivity(intent); }
From source file:Main.java
public static Bundle mapToBundle(Map<String, String> map) { Bundle bundle = new Bundle(); if (map != null) { for (String key : map.keySet()) { bundle.putString(key, map.get(key)); }/*www. ja va 2 s. c o m*/ } return bundle; }
From source file:com.manning.androidhacks.hack047.fragments.ColorFragment.java
public static ColorFragment newInstance(int color, String text) { final ColorFragment fragment = new ColorFragment(); Bundle args = new Bundle(); args.putInt(COLOR_KEY, color);// w w w .j a v a 2 s . co m args.putString(TEXT_KEY, text); fragment.setArguments(args); return fragment; }
From source file:com.manning.androidhacks.hack029.fragment.ColorFragment.java
public static ColorFragment newInstance(int color, String text, boolean isLandscape) { ColorFragment recreateFragment = new ColorFragment(); Bundle args = new Bundle(); args.putInt(COLOR_KEY, color);//w w w. j av a 2 s. c om args.putString(TEXT_KEY, text); args.putBoolean(LANDSCAPE_KEY, isLandscape); recreateFragment.setArguments(args); return recreateFragment; }
From source file:Main.java
/** * Puts string value to bundle if passed and creates it if {@code null} passed. * * @param bundle to put into//from w w w . j av a 2 s . c o m * @param key to to put under * @param value to put * @return bundle with the newly put value */ public static Bundle putString(Bundle bundle, String key, String value) { if (bundle == null) { bundle = new Bundle(); } bundle.putString(key, value); return bundle; }
From source file:com.savvywits.wethepeople.RESTResultFragment.java
public static RESTResultFragment newInstance(String string) { RESTResultFragment fragment = new RESTResultFragment(); Bundle bundle = new Bundle(); bundle.putString("result_string", string); fragment.setArguments(bundle);/*from w w w . ja v a2 s. com*/ return fragment; }
From source file:net.redwarp.android.app.githubcount.ProjectDetailFragment.java
public static ProjectDetailFragment newInstance(String user, String repository) { ProjectDetailFragment fragment = new ProjectDetailFragment(); Bundle args = new Bundle(); args.putString("user", user); args.putString("repository", repository); fragment.setArguments(args);//from w ww . ja v a 2 s . c o m return fragment; }
From source file:Main.java
public static Bundle convertHashMapToBundle(HashMap<String, String> properties) { if (properties == null) { return null; }//from w w w . j a v a 2 s. c o m Bundle result = new Bundle(); for (Map.Entry<String, String> entry : properties.entrySet()) { result.putString(entry.getKey(), entry.getValue()); } return result; }