• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

A question about lifietime of activities

 
Ranch Hand
Posts: 36
1
Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
In the book that I am reading there is a phrase :

"Even if an application has only one activity and the activity is killed, the
application will still be running in memory"

In this phrase , the underlined word killed , does mean onDestroy() ???
If yes , In several book , I read that when onDestroy() is called by Android , the resourses
that were ocuupied by application will be free ???
I am confuses . Which one is correct ??? The phrase that I mentioned or the things that I read in
several books ???
 
Rancher
Posts: 43081
77
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you check the javadocs of the Activity class you'll see that onDestroy will be called before the Activity is terminated.

But an application will normally consist of more than just a single Activity - there could be other activities still running, or services, or broadcast receivers, or providers. Each has their own associated set of resources. Only if none of those components run any more will all of the application resources be disposed of (like an android.app.Application if there is one).
 
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Peter, in what context did you find that sentence? The key word here is activity. As Ulf said there are other app components. Plus, if an activity is killed because of low memory it still can have its state saved so it can be recreated when the app comes in the foreground. The best place to learn about this is the Activity page.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic