我有两个活动 1. MainActivity(launchMode是标准的) 2. SecondActivity(launchMode是singleTask)
当我从MainActivity调用SecondActivity时,MainActivity的onActivityResult在SecondActivity的onCreate之前被调用。
class book
{
private String bookName;
private String authorName;
private String bookPrice;
public String getBookName() {
return bookName;
}
public void setBookName(String bookName) {
this.bookName = bookName;
}
public String getAuthorName() {
return authorName;
}
public void setAuthorName(String authorName) {
this.authorName = authorName;
}
public String getBookPrice() {
return bookPrice;
}
public void setBookPrice(String bookPrice) {
this.bookPrice = bookPrice;
}
这是MainActivity的onActivityResult()。
Intent intent = new Intent(MainActivity.this,SecondActivity.class);
startActivityForResult(intent, 115);
然后进入SecondActivity的onCreate()。
我已经读到,这是下面链接中的android的bug。 onActivityResult() called prematurely
到目前为止,是否有任何解决方案,我需要将LaunchMode用作SecondActivity的singleTask。