Search code examples
androidmultithreadingapplicationcontext

several thread = several Application Context?


it's been giving me headaches for the past 3 days :
I have a MyApp extending Application. When I call getApplication() from my services (running in different threads), I get a different instance of MyApp than when I call getApplication() from activites running in the main thread.
Is that a normal behavior ?


Solution

  • Unless your services are running in different processes this shouldn't happen. Are you sure they are actually different instances? On what platform are you testing?