0

Assume i has activity A and B and external class C. class C contains code to create dialog but requires contex. class B is like this one

activity A is in focus(active). Activity A call C to create dialog. In first case, A send's it's ActivityContext to C. In second case, C get application activity from B.

Are those two cases leads to same result? E.G dialog will pop up on a screen (on a screen of activity A)

Community
  • 1
  • 1
Yarh
  • 4,459
  • 5
  • 45
  • 95

1 Answers1

0

Yes, In android there's only 1 "Context" per application, is what documentation calls as Application Context, is where pretty much every single component related to your activity lives, so it doesn't matter what activity context reference you are using, in the end is the same since all the activities live within it, and taking on count that this app context follows the singleton design pattern be sure that is the very same instance object within the virtual machine...

Regards!

Martin Cazares
  • 13,637
  • 10
  • 47
  • 54
  • 1
    One application context - for one process. An application can have several processes, in this case every process has its own instance. – akarimova Jun 04 '13 at 22:08