问题
My TabActivity contains two tabs which calls two two different activities . I want to setResult() for the TabActivity when either one of the child finishes.
Is there any method to find out when my activity inside tab finishes ?
Thank you -Eby
回答1:
I found another way
` @Override
public void finishFromChild(Activity child)
{
setResult(REFRESH);
super.finishFromChild(child);
}
`
finsihFromChild will let us know when the child activity is finishing!! @pentium10 thank you very much for your suggestion..
回答2:
Ok i've got an even easier method to pass the result:
in your child activity do this
Intent list = this.getIntent();
list.setAction(Integer.toString(RESULT_CODE_TO_PASS));
finish();
and then in the parent do this:
@Override
public void finishFromChild(Activity child) {
Intent test = child.getIntent();
setResult(new Integer(test.getAction()));
super.finishFromChild(child);
}
回答3:
You need to issue a Broadcast from your child activity(when finished) and implement the BroadcastReceiver on the class you want to catch the broadcast. You can use the extras to transfer data from one activity to another.
来源:https://stackoverflow.com/questions/3369423/how-to-setresult-for-a-tabactivity-which-contains-activity-for-tabs