Do not place Android context classes in static fields; this is a memory leak
问题 I have a service which has a BeaconNotificationsManager , I want to access this BeaconNotificationsManager in my Activity . Currently my BeaconNotificationsManager is static : public class MyService extends Service { public static BeaconNotificationsManager bnm; } And I am accessing this in my Activity like this: if(MyService.bnm != null){ // do stuff } Although Android is telling me this is bad. What is the correct way to do this? 回答1: About Static issue: let just say you are referencing