//这是我的班级
private String name;
private int height;
private float weight;
private int age;
private Sex gender;
public String getName() {
return name;
}
public int getHeight() {
return height;
}
public float getWeight() {
return weight;
}
public int getAge() {
return age;
}
public Sex getGender() {
return gender;
}
public enum Sex {male, female, others}
;
public User(String name, Sex gender, int age, float weight, int height) {
this.name = name;
this.gender = gender;
this.age = age;
this.weight = weight;
this.height = height;
}
}
这是来自第一项活动
ArrayList<User> userList = new ArrayList<User>();
Intent intent = new Intent(ProfileSelect.this,MainActivity.class);
intent.putExtra("list",userList);
startActivity(intent);
现在我想将用户列表显示给另一个名为mainactivity的活动。如何检索mainactivity中的列表? Tq提前..
答案 0 :(得分:0)
您可以使用EventBus
// Post Object
EventBus.getDefault().postSticky(yourObject);
// Get Object
YourClass yourObject = EventBus.getDefault().getStickyEvent(YourClass.class);