samedi 5 avril 2014

Android View Paradigms


Vote count:

0




I'm creating my first Android application, and utilizing the Gson library to convert some custom objects to strings and back. I can convert an individual custom object back and forth easily, but run into trouble when attempting to convert a List of custom objects.


I know this probably isn't the most practical usage, but it's a short term solution. Here is the code:



List<CarObj>cars = dealership.getCar(); // grabbing the cars list from another object
String carsListString = gson.toJson(cars); // convert to json string


This won't compile....says it's expecting an expression. I've got the class definition parameter, and the json string, but I don't know what's missing:



List<CarObj>theCars = gson.fromJson(List<CarObj>, carListString);


Any hints are greatly appreciated.



asked 40 secs ago






Aucun commentaire:

Enregistrer un commentaire