How to setResult() for a TabActivity which contains activity for tabs

只愿长相守 提交于 2019-12-06 09:38:15

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..

Rohi Zacharia

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); 
        } 

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!