我的问题是带有可序列化对象数组的 putextra 方法。我的意思是,如果我尝试底部代码,它会抛出Caused by: java.io.NotSerializableException:
这是代码:
class Example implements Serializable
{
private int ID; // It has getters and setters and also other variables.
}
Intent inte=new Intent(this,OTHERCLASS.class);
Example[] examples=new Example[]; // It's just an example.
Bundle bundle = new Bundle();
bundle.putSerializable("Details", examples);
inte.putExtras(bundle);
startActivity(inte);
谢谢。