I want to convert a JSON string to android Bundle. The requirement was like to pass parameters to an activity directly from server as JSON rather than bundle. How to convert a JSON string to Android Bundle? Please provide abstract code if possible.
just a quick SSCCEE
A.class
// key for bundle ...
public static final JSON_STRING = "jsonString";
Intent intent = new Intent(A.this, B.class);
Bundle bundle = new Bundle();
bundle.putString(JSON_STRING,json.toString());
intent.putExtras(bundle);
startActivity(intent);
and then in B.class ...
Intent intent = getIntent();
Bundle extras = intent.getExtras();
String jsonString = extras.getString(A.JSON_STRING);