Java中的JSON对象无法立即实现可序列化。我已经看到其他人扩展了该类以允许这样做,但是对于您的情况,我只建议将JSON对象存储为字符串并使用其toString()函数。我已经成功了。
editor.putString("jsondata", jobj.toString());并找回它:
String strJson = sharedPref.getString("jsondata","0");//second parameter is necessary ie.,Value to return if this preference does not exist.if (strJson != null) {try { JSonObject response = new JSonObject(strJson); } catch (JSonException e) { } }http://developer.android.com/reference/org/json/JSONObject.html#JSonObject(java.lang.String)



