我知道如何处理方法jsonObj.toString()但我有理由不能这样做.我的JSONObject里面有一个JSONArray,它有太多的数据,所以如果我将它转换为String然后转换回我害怕它达到String类型的限制.所以我想传递一个纯对象,而不是使用该方法.我实现Parcelable接口来做到这一点,但我得到错误" java.lang.RuntimeException:Parcel:无法编组值 "
public class MJSONObject implements Parcelable {
private JSONObject jsonObject;
public MJSONObject() {
}
public MJSONObject(JSONObject jsonObject) {
this.jsonObject = jsonObject;
}
public void set(JSONObject jsonObject) {
this.jsonObject = jsonObject;
}
public JSONObject get() {
return jsonObject;
}
@Override
public int describeContents() {
// TODO Auto-generated method stub
return 0;
}
public static final Parcelable.Creator<MJSONObject> CREATOR = new Parcelable.Creator<MJSONObject>() {
public MJSONObject createFromParcel(Parcel in) {
return new MJSONObject(in);
}
public MJSONObject[] newArray(int size) {
return new MJSONObject[size];
} …Run Code Online (Sandbox Code Playgroud)