Eby
Eby

Reputation: 2789

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

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

Upvotes: 1

Views: 2216

Answers (3)

Rohi Zacharia
Rohi Zacharia

Reputation: 31

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

Upvotes: 3

Eby
Eby

Reputation: 2789

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

Upvotes: 5

Pentium10
Pentium10

Reputation: 208042

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.

Upvotes: 1

Related Questions