In a scenario where I have a UI that will be updated from a separate thread (using AsyncTask), I can define the AsyncTask as an inner class of the activity, but this has two
Quite a few examples I have seen just pass a Context
into the constructor of the AsyncTask
.
public class BackgroundStuff extends AsyncTask {
...
Context mContext;
...
BackgroundStuff(Context context){
super();
this.mContext = context;
}
...
}
I would be interested to hear if anyone else uses any other approaches.