The name says a lot about everything. If you have a callback from one class to another and need to call some method from a callback that requires context, what is the correct context to use? A common example is AsyncTask with a callback to the Activity or Fragment that used it.
I usually try to avoid using getApplicationContext() , but I cannot use this as the context from the callback. Is this the case when using a wider context is appropriate?
To clarify, I am thinking of an interface callback between AsyncTask and activity. Once I get into the redefined interface method, I cannot get the context of the actions from the inside.
android callback android-context android-asynctask
Raarw
source share