I have a class that implements Serializable...
public class Hop implements Serializable {
private static final long serialVersionUID = 1L;
public double d1;
public double d2;
public Date date1;
public String string;
public Date date2;
}
What I have is an List of Hops ...
List<Hop> hops = new ArrayList<Hop>();
hops.add(hop1);
hops.add(hop2);
JSONObject json = new JSONObject();
json.put("uniqueArrays", new JSONArray(hops));
String arrayList = json.toString();
then I saved this String in SQLite with many other things ...
When I retrieve this String from DB, I want to convert it to List but I am not succesfull ...
How I to it:
JSONObject json = new JSONObject(arrayList );
JSONArray items = json.optJSONArray("uniqueArrays");
how can I convert JSONArray to List ?
//EDIT This is how they looks like when I retrieve them from DB:
JSONObject: {"uniqueArrays":["com.myapp.app.Hop@41c18ce8"]}
JSONArray :["com.myapp.app.Hop@41c18ce8"]