0

Hi i serialized a list List<Show> list; to pass it through an intent using

String listSerializedToJson = new Gson().toJson(mShowAdapter.getList());

Now In the other activity I got the json like this:

String listSerializedToJson = getIntent().getExtras().getString("LIST_OF_OBJECTS");

How do I transform it back into a List<Show> list;?

fgoogle
  • 79
  • 9

1 Answers1

1
Type listType = new TypeToken<ArrayList<Show>>(){}.getType();
List<Show> yourClassList = new Gson().fromJson(listSerializedToJson , listType);
M.Yogeshwaran
  • 1,419
  • 4
  • 22
  • 48