This Handler class should be static or leaks might occur: IncomingHandler

I’m developing an Android 2.3.3 application with a service. I have this inside that service to communicate with Main activity: public class UDPListenerService extends Service { private static final String TAG = “UDPListenerService”; //private ThreadGroup myThreads = new ThreadGroup(“UDPListenerServiceWorker”); private UDPListenerThread myThread; /** * Handler to communicate from WorkerThread to service. */ private Handler mServiceHandler; … Read more

Static Classes In Java

Java has static nested classes but it sounds like you’re looking for a top-level static class. Java has no way of making a top-level class static but you can simulate a static class like this: Declare your class final – Prevents extension of the class since extending a static class makes no sense Make the … Read more