How to convert a Vector to JSONArray?
问题 I need to convert a Vector<Vector<Float>> to a JSONArray . Apart from iterating through the vector and creating the JSONArray , is there any simpler way to do this? Someone told me to try gson. 回答1: SharedPreferences is just a key-value store. What's stopping you from bypassing JSONObject completely, and just using something like this (Gson only)? private static final Type DATA_TYPE = new TypeToken<Vector<Vector<Float>>>() {}.getType(); Storage: Vector<Vector<Float>> data = new Vector<Vector