List of usage examples for android.os Bundle Bundle
public Bundle()
From source file:Main.java
@SuppressWarnings("deprecation") public static Bundle decodeUrl(String s) { Bundle params = new Bundle(); if (s != null) { String array[] = s.split("&"); for (String parameter : array) { String v[] = parameter.split("="); if (v.length > 1) { params.putString(v[0], URLDecoder.decode(v[1])); }//from w ww . j a va 2 s.c om } } return params; }
From source file:Main.java
public static void goToActivity(Context packageContext, Class<?> targetActivityClass, String paraName, Object paramValue) {/*from ww w.j a v a 2s .c o 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, Serializable> map) { Bundle result = new Bundle(); if (map == null) return result; for (String key : map.keySet()) { result.putSerializable(key, map.get(key)); }/*from www . j ava2 s .com*/ return result; }
From source file:com.skubit.bitid.fragments.SignInResponseFragment.java
public static SignInResponseFragment newInstance(int resultCode, String message) { SignInResponseFragment signInResponseFragment = new SignInResponseFragment(); Bundle bundle = new Bundle(); bundle.putInt("resultCode", resultCode); if (!TextUtils.isEmpty(message)) { bundle.putString("message", message); }/* w w w . j a v a2 s . c o m*/ signInResponseFragment.setArguments(bundle); return signInResponseFragment; }
From source file:Main.java
@SuppressWarnings("unchecked") public static Bundle addMapToBundle(HashMap<String, ?> map, Bundle bundle) { for (String key : map.keySet()) { Object value = map.get(key); if (value instanceof String) { bundle.putString(key, (String) value); } else if (value instanceof Integer) { bundle.putInt(key, (Integer) value); } else if (value instanceof Double) { bundle.putDouble(key, ((Double) value)); } else if (value instanceof Boolean) { bundle.putBoolean(key, (Boolean) value); } else if (value instanceof HashMap) { bundle.putBundle(key, addMapToBundle((HashMap<String, Object>) value, new Bundle())); } else if (value instanceof ArrayList) { putArray(key, (ArrayList) value, bundle); }//from w w w. j a v a 2s.co m } return bundle; }
From source file:Main.java
/** * Parse a URL query and fragment parameters into a key-value bundle. * * @param url the URL to parse/*from w ww .jav a2s . c om*/ * @return a dictionary bundle of keys and values */ @Deprecated public static Bundle parseUrl(String url) { // hack to prevent MalformedURLException url = url.replace("fbconnect", "http"); try { URL u = new URL(url); Bundle b = decodeUrl(u.getQuery()); b.putAll(decodeUrl(u.getRef())); return b; } catch (MalformedURLException e) { return new Bundle(); } }
From source file:Main.java
/** * Parse a URL query and fragment parameters into a key-value bundle. * //from ww w.j av a 2 s.c o m * @param url the URL to parse * @return a dictionary bundle of keys and values */ public static Bundle parseUrl(String url) { // hack to prevent MalformedURLException url = url.replace("fbconnect", "http"); try { URL u = new URL(url); Bundle b = decodeUrl(u.getQuery()); b.putAll(decodeUrl(u.getRef())); return b; } catch (MalformedURLException e) { return new Bundle(); } }
From source file:com.ryan.ryanreader.fragments.PostPropertiesDialog.java
public static PostPropertiesDialog newInstance(final RedditPost post) { final PostPropertiesDialog pp = new PostPropertiesDialog(); final Bundle args = new Bundle(); args.putParcelable("post", post); pp.setArguments(args);/* ww w .j a v a 2s .co m*/ return pp; }
From source file:Main.java
@Deprecated public static Bundle decodeUrl(String s) { Bundle params = new Bundle(); if (s != null) { String array[] = s.split("&"); for (String parameter : array) { String v[] = parameter.split("="); try { if (v.length == 2) { params.putString(URLDecoder.decode(v[0], UTF8), URLDecoder.decode(v[1], UTF8)); } else if (v.length == 1) { params.putString(URLDecoder.decode(v[0], UTF8), ""); }/*from w w w . java 2 s.co m*/ } catch (UnsupportedEncodingException e) { // shouldn't happen } } } return params; }
From source file:Main.java
public static Bundle decodeUrl(String s) { Bundle params = new Bundle(); if (s != null) { String array[] = s.split("&"); for (String parameter : array) { String v[] = parameter.split("="); params.putString(URLDecoder.decode(v[0]), URLDecoder.decode(v[1])); }// w w w . j ava 2 s . co m } return params; }