This would be true only if activity A called its finish after starting B.
Otherwise A remains on the backstack and reappears when B finishes.
On Jul 30, 2014 5:19 AM, "janvi" <[email protected]> wrote:

> Hi Deepak
>
> Thank you for your support:)
>
> But if I do not call Activity A onbackpress of B then if just finishes the
> App I mean App gets closed.
>
> MyCode
>
>  onClick(..) {
>
>   start activity B
>  }
> }class B : Activity {
>  onBackPressed() {
>   this.finish();
>
> Any help would be appreciated:)
> Thanks in advance
>
> On Sunday, July 20, 2014 9:42:50 PM UTC+5:30, Deepak wrote:
>>
>> Have you overridden onBackPressed in activity B in which case you should
>> call this.finish() in B. Your code should look similar to this
>> class A : Activity {
>>  onClick(..) {
>>   start activity B
>>  }
>> }
>>
>> class B : Activity {
>>  onBackPressed() {
>>   this.finish(); /* this takes you back to the previous activity on
>> stack. You need not do start activity to go to A as it will create new
>> activity A and launch it instead of closing B and going to previous A.*/
>>  }
>> }
>>
>  --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Android Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to