Hi All,
I created a restart() method to restart an Activity, there are some
reasons for us to do this since there are some thing that we can not
do unless we make the Activity completely restarted, for example, if
the SurfaceView is created in GPU memory and we want to "move" it back
to normal memory, than we have to restart the Activity.
Anyway, the following cod is our implementation of restart():

    public void restart(String commandLineArguments)
    {
        Intent intent = new android.content.Intent();
        intent.setClass(this, this.getClass());  //We will start the
Activity itself, not any other
        this.startActivity(intent);
        //this.finish();                     //I need to remove this
line, otherwise the new Activity will just live for a short moment.
    }

The code is almost same as the SDK sample cod from "Forwarding.java"
except the last line "this.finish()". If we have this line, then the
newly started Activity will be shut down too (why?). After I
eliminated this line, a new Activity is started successfully but the
"old activity" is still inside of the Activity Stack, as the result,
there going to be numbers of instance of same Activity in the Activity
stack.

So the question is: how to properly kill previous Activity in the
newly launched Activity? Or, in other words, how can a Activity knows
"who launched me? and need to terminate it" I tried to use Intent, but
could not find a suitable function.

Many thanks for any suggestions.
Hongkun
www.omnigsoft.com

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to