Intent启动活动并传递数据至BookCatalogActivity.class
Intent intent = new Intent(A.class, B.class);
intent.putExtra("book_item", mCurBookItem);
startActivityForResult(intent,1);
//后面的 1 是onActivityResult接收到B.class活动结束后传回的requestCode值;
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
switch (requestCode) {
case 1: //若为1,说明是B.class活动返回
}
B.class接收数组数据(若是其它类型数据更改getSerializableExtra):
private BookItemmCurBookItem;
mCurBookItem = (BookItem) getIntent().getSerializableExtra("book_item");
B.class返回int resultCode和 Intent data:
setResult(resultCode, data);
两个String相比较a. equals(b);