Hi,

If the version u used is before 2.2, I guess u can try this methord:
ActivityManager activityManager =
            (ActivityManager)
context.getSystemService(Context.ACTIVITY_SERVICE);
        activityManager.restartPackage("packagename");
If the version is 2.2 or later: u may try this:

public static List<Activity> activityList = new ArrayList<Activity>();
protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        activityList.add(this);
    public static void exitClient(Context context)
    {
        Log.d(TAG, "----- exitClient -----");
       for (int i = 0; i < activityList.size(); i++)
        {
            if (null != activityList.get(i))
            {
                activityList.get(i).finish();
            }
         }
        ActivityManager activityManager =(ActivityManager)
context.getSystemService(Context.ACTIVITY_SERVICE);
        activityManager.restartPackage("com.huawei.softclient.mtvclient");
        System.exit(0);
    }

On Wed, Aug 10, 2011 at 11:05 PM, 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

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