Bug 776027 - Move intent handling to IntentHelper. r=wesj
This commit is contained in:
@@ -7,6 +7,7 @@ package org.mozilla.gecko.util;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
@@ -54,4 +55,21 @@ public final class JSONUtils {
|
||||
throw new IllegalArgumentException(name + "=" + uuidString, e);
|
||||
}
|
||||
}
|
||||
|
||||
public static JSONObject bundleToJSON(Bundle bundle) {
|
||||
JSONObject json = new JSONObject();
|
||||
if (bundle == null) {
|
||||
return json;
|
||||
}
|
||||
|
||||
for (String key : bundle.keySet()) {
|
||||
try {
|
||||
json.put(key, bundle.get(key));
|
||||
} catch (JSONException e) {
|
||||
Log.w(LOGTAG, "Error building JSON response.", e);
|
||||
}
|
||||
}
|
||||
|
||||
return json;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user