List of usage examples for android.os Bundle keySet
public Set<String> keySet()
From source file:com.mikecorrigan.bohrium.pubsub.JSONCodec.java
public static JSONObject toJson(final Bundle bundle) { Log.v(TAG, "toJson"); JSONObject j = new JSONObject(); try {/* w ww. j av a 2 s. c o m*/ for (final String key : bundle.keySet()) { final Object value = bundle.get(key); Log.v(TAG, "key=" + key + ", value=" + value.toString()); j.put(key, value.toString()); } return j; } catch (JSONException e) { Log.e(TAG, "exception=" + e); Log.e(TAG, Log.getStackTraceString(e)); } return null; }
From source file:com.parse.applinksanalytics.ParseAppLinksBroadcastReceiver.java
private static Map<String, String> convertBundleToMap(Bundle bundle) { Map<String, String> map = new HashMap<String, String>(); for (String key : bundle.keySet()) { map.put(key, bundle.getString(key)); }// w w w .j a va 2 s . c o m return map; }
From source file:com.freshplanet.nativeExtensions.Extension.java
public static String getParametersFromIntent(Intent intent) { JSONObject paramsJson = new JSONObject(); Bundle bundle = intent.getExtras(); String parameters = intent.getStringExtra("parameters"); try {// w w w .j a v a 2 s .com for (String key : bundle.keySet()) { paramsJson.put(key, bundle.getString(key)); } if (parameters != null) { paramsJson.put("parameters", new JSONObject(parameters)); } } catch (JSONException e) { e.printStackTrace(); } return paramsJson.toString(); }
From source file:com.idean.atthack.api.Param.java
/** * Util for logging bundle of params/*from ww w . jav a 2 s . c om*/ */ public static String toString(Bundle bundle) { StringBuffer b = new StringBuffer(); for (String key : bundle.keySet()) { b.append("[" + key + "] "); b.append(bundle.get(key) + ", "); } return b.toString(); }
From source file:Main.java
public static void printeBackup(Bundle data, String lev) { if (!debug) { return;//from ww w . j a v a2 s . c o m } Log.d("backup", "---- " + lev + " begin ----"); if (null != data) { for (String key : data.keySet()) { Object value = data.get(key); Log.d("backup", "key = " + key + " , value = " + value); } } }
From source file:Main.java
public static Uri buildUri(String authority, String path, Bundle parameters) { Uri.Builder builder = new Uri.Builder(); builder.scheme(URL_SCHEME);//from ww w . ja v a 2s. c om builder.authority(authority); builder.path(path); for (String key : parameters.keySet()) { Object parameter = parameters.get(key); if (parameter instanceof String) { builder.appendQueryParameter(key, (String) parameter); } } return builder.build(); }
From source file:Main.java
@SuppressWarnings("deprecation") public static String encodeUrl(Bundle parameters) { if (parameters == null) { return ""; }/*www .ja v a 2 s . com*/ StringBuilder sb = new StringBuilder(); boolean first = true; for (String key : parameters.keySet()) { if (first) first = false; else sb.append("&"); if (parameters.getString(key) != null) { sb.append(URLEncoder.encode(key) + "=" + URLEncoder.encode(parameters.getString(key))); } } return sb.toString(); }
From source file:Main.java
public static String encodeUrl(Bundle parameters) { if (parameters == null) { return ""; }/*from w ww .j a v a 2s . c o m*/ StringBuilder sb = new StringBuilder(); boolean first = true; for (String key : parameters.keySet()) { Object parameter = parameters.get(key); if (!(parameter instanceof String)) { continue; } if (first) first = false; else sb.append("&"); sb.append(URLEncoder.encode(key) + "=" + URLEncoder.encode(parameters.getString(key))); } return sb.toString(); }
From source file:Main.java
@Deprecated public static String encodeUrl(Bundle parameters) { if (parameters == null) { return ""; }//w w w . j a v a 2 s. co m StringBuilder sb = new StringBuilder(); boolean first = true; for (String key : parameters.keySet()) { Object parameter = parameters.get(key); if (!(parameter instanceof String)) { continue; } if (first) first = false; else sb.append("&"); sb.append(URLEncoder.encode(key) + "=" + URLEncoder.encode(parameters.getString(key))); } return sb.toString(); }
From source file:org.mariotaku.twidere.util.CompareUtils.java
public static boolean bundleEquals(final Bundle bundle1, final Bundle bundle2, final String... ignoredKeys) { if (bundle1 == null || bundle2 == null) return bundle1 == bundle2; for (String key : bundle1.keySet()) { if (!ArrayUtils.contains(ignoredKeys, key) && !objectEquals(bundle1.get(key), bundle2.get(key))) return false; }// ww w.jav a2 s . c o m return true; }