sreelallalu
5/10/2017 - 11:01 AM

Gson _ Listview

Gson _ Listview

   //gradle gson  
     compile 'com.google.code.gson:gson:2.8.0'

  
  
  //convet listview to string 
  
  String save_ = new Gson().toJson(itemsList);
  
  //reverse process
  
  Gson gson = new Gson();
        Type listType = new TypeToken<List<Adapter1Items>>(){}.getType();
      List<Adapter1Items>  itemsList = (List<Adapter1Items>) gson.fromJson(result, listType);