What is difference between context and activity?

What is difference between context and activity?
Answer
2 Answers. An Application context lasts, as long as your app is alive, while the Activity context dies with your Activity (it is not valid after onDestroy of that Activity). So if you need the Context across Activities (i.e. in a Singleton) you will be better off using an Application context.
 

Tìm kiếm

Back
Top