I am facing the issues in sending and receiving the google json objects from activity to another activity.
List<Integer> selectedScamMediumIds = scamMediumHorizontalAdapter.getSelectedScamMediumIds();
JsonObject scamData = new JsonObject();
JsonArray scamMediumJsonArray = new JsonArray();
for (Integer scamMediumId:selectedScamMediumIds) {
JsonPrimitive jsonPrimitive = new JsonPrimitive(scamMediumId);
scamMediumJsonArray.add(jsonPrimitive);
}
scamData.add("scam_medium_id",scamMediumJsonArray);
scamData.addProperty("scam_category_id", scamCategoryId);
scamData.addProperty("scam_sub_category_id", scamSubCategoryId + "");
scamData.addProperty("scammer_phone", phoneNumber.getText().toString());
scamData.addProperty("scammer_location", scammerLocation.getText().toString());
scamData.addProperty("lat", lattitude);
scamData.addProperty("lng", longitude);
Intent intent = new Intent(ScamLookUpActivity.this, ScamSearchActivity.class);
intent.putExtra("scamDatas", scamData.toString());
intent.putExtra("scamSubCategoryText", subCategoryTitle);
startActivity(intent);
I have tried the above method, I don't know whether it is correct or not. Please help me how to send and receive the json object from one activity to another activity.