30.12.2010 17:52, svebee пишет:
I understand that reference to the context that I pass in will go away if activity is destroyed (and because of that I use application context which will stay until whole application is destroyed), but when I should use it (activity context) any why? Some example would help me. Some explanation of the "barrier"/boundary between those two.
The framework defines several subclasses of Context. The ones you'll deal with most often is Activity and Service.
The general rule is: use application context when you need its special lifetime property (such as when creating a singleton class); use the "nearest" context in all other cases. This includes using Activity ("this") for all UI-related stuff, the UI components actually depend on that.
-- Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com -- 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

