Still no luck. See my reply below.
On Tue, May 20, 2008 at 08:03:28AM -0400, Mark Murphy wrote: > > > >How can I go back to the previous instance? > > If by "click on my application again", you mean you clicked on your icon > in the launcher, by default that should create another instance of your > activity process. In that respect, the launcher works the same as > launchers in other OSes. > > The "home" key brings up the Launcher activity and puts it at the top of > the activity stack. Pressing the back button should eventually return > you to your existing activity instance. > If by "back button" you mean the one on the right side with an arrow to the left-top, it does not work to me. Press back button and nothing happened, > If you only want at most one instance of your activity running, you > probably want to take a look at the android:launchMode attribute of the > <activity> element of your AndroidManifest.xml file: > > http://code.google.com/android/reference/android/R.styleable.html#AndroidManifestActivity_launchMode > > You'd want to set android:launchMode to singleTop, singleTask, or > singleInstance, depending on what you're trying to achieve. > I tried them all, but it seems onCreate() is always called in each case. Isn't that conflicting with all these modes? How do I which call represents "bringing to front" so that I will know not to start the socket thread. > >Alternatively, I was thinking whenever my application becomes > >invisible I can try to terminate my application completely, instead of > >letting hang around and causes problem next time I click the app > >again. How do I do that? > > If you don't need the socket connection when you're not visible, I'd > drop the socket in onPause() and bind in onResume(): > > http://code.google.com/android/reference/android/app/Activity.html#ActivityLifecycle > Unfortunately it appears when the thread is doing accept(), it cannot be interrupted. Is that true? > If you really want to close your activity, call finish() on the > activity, and that will have it close up shop. > It appears the socket thread did not get killed even when I call super.finish(). Jun --~--~---------~--~----~------------~-------~--~----~ 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] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

