MainActivity.this no es una clase que incluye AsyncTask

Estoy tratando de crear una AsyncTask por primera vez, pero no tengo mucha suerte.

Mi AsyncTask necesita obtener información de un servidor y luego agregar nuevos diseños al diseño principal para mostrar esta información.

Todo parece estar más o menos claro, pero el mensaje de error "MainActivity no es una clase adjunta" me molesta.

Nadie más parece tener este problema, así que creo que me olvido de algo muy obvio, simplemente no sé qué es.

Además, no estoy seguro de si usé la forma correcta de obtener el contexto, y como mi aplicación no se compila, no puedo probarlo.

Su ayuda es muy apreciada.

Aquí está mi código:

public class BackgroundWorker extends AsyncTask<Context, String, ArrayList<Card>> {
    Context ApplicationContext;

    @Override
    protected ArrayList<Card> doInBackground(Context... contexts) {
        this.ApplicationContext = contexts[0];//Is it this right way to get the context?
        SomeClass someClass = new SomeClass();

        return someClass.getCards();
    }

    /**
     * Updates the GUI before the operation started
     */
    @Override
    protected void onPreExecute() {
        super.onPreExecute();
    }

    @Override
    /**
     * Updates the GUI after operation has been completed
     */
    protected void onPostExecute(ArrayList<Card> cards) {
        super.onPostExecute(cards);

        int counter = 0;
        // Amount of "cards" can be different each time
        for (Card card : cards) {
            //Create new view
            LayoutInflater inflater = (LayoutInflater) ApplicationContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            ViewSwitcher view = (ViewSwitcher)inflater.inflate(R.layout.card_layout, null);
            ImageButton imageButton = (ImageButton)view.findViewById(R.id.card_button_edit_nickname);

            /**
             * A lot of irrelevant operations here
             */ 

            // I'm getting the error message below
            LinearLayout insertPoint = (LinearLayout)MainActivity.this.findViewById(R.id.main);
            insertPoint.addView(view, counter++, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
        }
    }
}

Respuestas a la pregunta(1)

Su respuesta a la pregunta