I have a Fragment
in which I use an AsyncTask
to send a tweet. I send the tweet in doInBackground
, and when it's sent, onPostExecute
is called and I'd like to show a Toast
(or any notification) to the user.
The issue is that if the Fragment
is paused (e.g. the user changed screens during the twitter request), no more context is available to call
Toast.makeText(Context context, CharSequence text, int duration)
I'm aware of other similar questions, like this one, but I couldn't find any answer...
... and keeping a local copy of the context seems very wrong.
Any suggestion?