getting context in AsyncTask
I am trying to get the context in my AsyncTask of the class called Opciones(this class is the only one that call that task) but I don't know how to do it, I saw some code like this: protected void onPostExecute(Long result) { Toast.makeText(Opciones.this,"Subiendo la foto. ¡Tras ser moderada empezara a ser votada!: ", Toast.LENGTH_LONG).show(); } But it doesn't work for me it says: "No enclosing instance of the type Opciones in scope" 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