Convert ArrayList to string and back to ArrayList | Techbirds
Posted on: September 5, 2017 /
Categories: Mobile Applications
1:Download gson-2.2.4.jar and Insert Library inside libs folder
2:Then for ex:- you have a ArrayList like this ArrayList filelist= new ArrayList();
then you can change it to string
String json = new Gson().toJson(filelist);
And if you want to change back to ArrayList then
Type type = (Type) new TypeToken() { }.getType(); filelist= new Gson().fromJson( json (java.lang.reflect.Type) type);
}
536 total views, 2 views today
Share this On