Tima
Tima

Reputation: 12905

Android activities question

I have three activities, A, B and C.

User can start activity B from A, and then C from B.

I would like to have following. In C the user fill some field and click "OK"-Button. After that both activities B and C should be finished.

I don't like my idea, to finish A after starting B, then finish B after starting C, and then start A from C.

What is the best way to do that?!

Is it possible to finish parent activity from the child? If, yes, then that would be my solution. But i haven't find any information about that.

Thank you,

Mur

Upvotes: 0

Views: 88

Answers (2)

Harshal Kalavadiya
Harshal Kalavadiya

Reputation: 2436

try This In Activity C Class

 Intent mIntent=new Intent(getApplicationContext(),A.class).setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
 startActivityForResult(mIntent);

Upvotes: 0

Thorstenvv
Thorstenvv

Reputation: 5396

in Activity B, call Activity C with startActivityForResult. In the ActivityB.onActivityResult() method, call finish() when Activity C returned with a good result. This gets you back to Activity A.

Upvotes: 1

Related Questions