getting context in AsyncTask
You need to do following things. when you want to use AsyncTask, extend that in other class say MyCustomTask. in constructor of new class, pass Context Example public class MyCustomTask extends AsyncTask<Void, Void, Long> { private Context mContext; public MyCustomTask (Context context){ mContext = context; } //other methods like onPreExecute etc. protected void onPostExecute(Long result) … Read more