Activity B is not running in the background. It's already stopped, so
you just need to call finish() to stop Activity A.

But since you already do that I assume that there is some other
problem. Maybe you call startActivity() to get back to Activity A from
Activity B? Call finish() instead in Activity B.

On 10 Aug, 17:06, xzoom <[email protected]> wrote:
> Hi,
> I have an activity A (a menu) that creates and start activity B (a
> running game).
>
>         public void onClick(View v) {
>                 switch(v.getId()){
>                         case R.id.start:
>                                 Intent i = new Intent(this, 
> GameActivity.class);
>                                 startActivity(i);
>                                 break;
>                         case R.id.exit:
>                                 finish();
>                                 break;
>                 }
>         }
>
> When I'm back into the menu (activity A) and while activity B is in
> the background , I want to stop activity A and B. How to do it?
> thanks.

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

Reply via email to