Mustansar Saeed
Mustansar Saeed

Reputation: 2790

Getting Application Context in Different Package

I have to access the Context in different package. The thing which I am achieving is that I want to save a Integer value in Preferences and want to get the value in different package. Is there any way to achieve this? Actually, there is an asynchronous method which is being used in different package, and I want to do some processing before call come back to my package? How can I achieve this?

Upvotes: 0

Views: 1261

Answers (1)

Vivek C A
Vivek C A

Reputation: 1145

getApplicationContext() will return you the context in application level. If you want to get the context is Activity level just use "ActivityName.this" or if its in fragment use getActivity()

Upvotes: 1

Related Questions