Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Terminating an application?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Mark Wyszomierski  
View profile  
 More options Oct 31 2008, 2:14 pm
From: Mark Wyszomierski <mar...@gmail.com>
Date: Fri, 31 Oct 2008 11:14:55 -0700 (PDT)
Local: Fri, Oct 31 2008 2:14 pm
Subject: Terminating an application?
Hi,

When our application is started, our main Activity comes alive. In the
emulator, how do you "kill" the application? It seems my Activity is
living forever. Does the user have a choice to kill the application
unless we put a menu option in to kill it? If no such option exists,
how does the user terminate the application?

Thanks


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Romain Guy  
View profile  
 More options Oct 31 2008, 2:57 pm
From: Romain Guy <romain...@google.com>
Date: Fri, 31 Oct 2008 11:57:03 -0700
Local: Fri, Oct 31 2008 2:57 pm
Subject: Re: [android-developers] Terminating an application?
The user doesn't, the system handles this automatically. That's what
the activity lifecycle (especially onPause/onStop/onDestroy) is for.
No matter what you do, do not put a "quit" or "exit" application
button. It is useless with Android's application model. This is also
contrary to how core applications work.

Note that when the user presses Back, the Activity is destroyed.

On Fri, Oct 31, 2008 at 11:14 AM, Mark Wyszomierski <mar...@gmail.com> wrote:

> Hi,

> When our application is started, our main Activity comes alive. In the
> emulator, how do you "kill" the application? It seems my Activity is
> living forever. Does the user have a choice to kill the application
> unless we put a menu option in to kill it? If no such option exists,
> how does the user terminate the application?

> Thanks

--
Romain Guy
www.curious-creature.org

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mark Wyszomierski  
View profile  
 More options Oct 31 2008, 3:02 pm
From: Mark Wyszomierski <mar...@gmail.com>
Date: Fri, 31 Oct 2008 12:02:46 -0700 (PDT)
Local: Fri, Oct 31 2008 3:02 pm
Subject: Re: Terminating an application?
Hi Romain Guy,

Ok so we never put an "exit app" interface for users - what happens in
this case:

public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        if (m_thread == null) {
                m_thread = new Thread() {
                        public void run() {
                                while (m_run) {
                                     Log.d("*", "hello...");
                                     Thread.sleep(5000);
                                }
                        }
                };
                m_thread.start();
       }

}

This app just creates a background thread which runs forever. When I
hit the back button etc, I can see that the thread is still alive even
though the Activity is no longer visible. If I start the app again, I
can see that m_thread is already initialized -

So in my case, I should listen for onDestroy() and terminate the
thread there?

Thank you

On Oct 31, 2:57 pm, Romain Guy <romain...@google.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Romain Guy  
View profile  
 More options Oct 31 2008, 3:06 pm
From: Romain Guy <romain...@google.com>
Date: Fri, 31 Oct 2008 12:06:23 -0700
Local: Fri, Oct 31 2008 3:06 pm
Subject: Re: [android-developers] Re: Terminating an application?
That's correct :)

--
Romain Guy
www.curious-creature.org

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Justin (Google Employee)  
View profile  
 More options Oct 31 2008, 3:13 pm
From: "Justin (Google Employee)" <j...@google.com>
Date: Fri, 31 Oct 2008 12:13:23 -0700 (PDT)
Local: Fri, Oct 31 2008 3:13 pm
Subject: Re: Terminating an application?

> So in my case, I should listen for onDestroy() and terminate the
> thread there?

Well, that depends. They're aren't many reasons for you to be
executing in your Activity when it is not visible. You should stop all
threads when you receive onPause().

If you have background processing, this should be done in a Service,
and perhaps a remote one so that the process hosting your Activity can
be killed, and leave your Service to do whatever it needs to do.

Cheers,
Justin
Android Team @ Google

On Oct 31, 12:02 pm, Mark Wyszomierski <mar...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »