Intent傳遞資料 對於GsonFormat生成的資料需要將裡面的所有內部類實現序列化接口才可打包過去
阿新 • • 發佈:2018-12-26
Intent傳遞資料
對於GsonFormat生成的資料需要將裡面的所有內部類實現序列化接口才可打包過去
Intent intent = new Intent(context,ReYinKouBeiActivity.class);
Bundle bundle=new Bundle();
bundle.putSerializable("data",reYinKouBeiBean); intent.putExtras(bundle); ReYinKouBeiBean data = (ReYinKouBeiBean) getIntent().getSerializableExtra("data") ;
Toast.makeText(this,data.toString(),Toast.LENGTH_SHORT).show();
public class ReYinKouBeiBean implements Serializable{
private DataBean data;
public DataBean getData() {
return data;
}
public void setData(DataBean data) {
this.data = data;
}
public static class DataBean implements Serializable{
public static class PagingBean implements Serializable{
public static class MoviesBean implements Serializable{
}
}
Bundle bundle=new Bundle();
bundle.putSerializable("data",reYinKouBeiBean); intent.putExtras(bundle); ReYinKouBeiBean data = (ReYinKouBeiBean) getIntent().getSerializableExtra("data")
Toast.makeText(this,data.toString(),Toast.LENGTH_SHORT).show();
public class ReYinKouBeiBean implements Serializable{
private DataBean data;
public DataBean getData() {
return data;
}
public void setData(DataBean data) {
this.data = data;
}
public static class
}