How do you find activity context?

Phương Quyên

New member
How do you find activity context?
Answer
Rules:
  1. Use getContext() or Activity. …
  2. Use getApplicationContext() if you need application-level context, which is not tight to any views/activities (for instance, in BroadcastReceiver or Service)
  3. Do not use getBaseContext(). …
  4. Make use of WeakReference if you need to access context from inside the threads.
14 февр. 2017 г.
 

Tìm kiếm

Back
Top