我有 2 个活动
活动1
活动2
活动1:
Intent intent= new Intent(Activity1.this,Acivity2.class);
Bundle b=new Bundle();
b.putParcelableArrayList("actionArray", (ArrayList<? extends Parcelable>) AllListArray.get(0));
b.putParcelableArrayList("comedyArray", (ArrayList<? extends Parcelable>) AllListArray.get(1));
b.putParcelableArrayList("loveArray", (ArrayList<? extends Parcelable>) AllListArray.get(2));
b.putParcelableArrayList("classicsArray", (ArrayList<? extends Parcelable>) AllListArray.get(3));
b.putParcelableArrayList("familyArray", (ArrayList<? extends Parcelable>) AllListArray.get(4));
intent.putExtras(b);
startActivity(intent);
活动2:
活动2:
public List<Movie> actionArray;
public List<Movie> comedyArray;
public List<Movie> loveArray;
public List<Movie> classicsArray;
public List<Movie> familyArray;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Bundle recdData = getIntent().getExtras();
if(recdData!=null) {
actionArray=recdData.getParcelableArrayList("actionArray");
comedyArray=recdData.getParcelableArrayList("comedyArray");
loveArray=recdData.getParcelableArrayList("loveArray");
classicsArray=recdData.getParcelableArrayList("classicsArray");
familyArray=recdData.getParcelableArrayList("familyArray");
}
}
我的要求是将 in 存储Bundle(recdData)
在Sharedpreferences
Activity2 中?任何人都可以帮助我吗?