How to use putExtra to get JsonObject? I want to get JSON text to display another activity.
 @Override
 protected String doInBackground(Void... v) {
    HashMap<String, String> params = new HashMap<>();
    params.put(KEY_MEMBER_ID, memberId);
    params.put(KEY_PWD, pwd);
    JSONParser jParser = new JSONParser();
    JSONObject json = jParser.sendPostRequest(GlobalVariabel.URL_LOGIN_MEMBER, params);
    System.out.println("URL :######### "+GlobalVariabel.URL_LOGIN_MEMBER);
    try {
        status = json.getString("STATUS");
        System.out.println("STATUSSSSSSSSSSSSSSSSSS : " + status);
        System.out.println(json);
        JSONObject jObj = json.getJSONObject("PROFILE");
        if (jObj != null) {
            user_id = jObj.getString("USER_ID");
            profile_url = jObj.getString("PROFILE_URL");
            date_joined = jObj.getString("DATE_JOINED");
            phone_type = jObj.getString("PHONE_TYPE");
            email = jObj.getString("EMAIL");
            name = jObj.getString("NAME");
        }
        } catch (JSONException e) {
            e.printStackTrace();
        }
            return null;
        }
I want get JsonObject email and name use intent.putExtra to another activity.
Intent intent = new Intent(getActivity(), MainActivity.class);
                    intent.putExtra(".... ", ....);
                    //intent.setFlags(intent.getFlags() | Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_ACTIVITY_CLEAR_TASK);
                    startActivity(intent);
                For sending the json
Intent intent = new Intent(getActivity(), MainActivity.class);
                intent.putExtra("json", jsonObject.toString());
                startActivity(intent);
For retrieving
       if(getIntent().hasExtra("json")) { 
       JsonObject mJsonObject = new JsonObject(getIntent().getStringExtra("json"));
    }
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With