I don't understand why I'm receiving this compile error; none of my classes or methods involved here are static. Maybe someone can shed some light here.
In my MainActivity class I have declared a public class that extends AsyncTask:
public class AsyncStuff extends AsyncTask<String, Void, String> {
...
}
In my non-activity class I have a public function that should fire the async task:
public class Util {
public void ExecuteAsyncMethod(){
MainActivity.AsyncStuff.execute(new String[]{"test" }); // error here
}
}
I have also tried to instantiate an object of the MainActivity.AsyncStuff class and execute its execute() method, but this doesn't work either since it's not in an enclosing class. I can't move it somewhere else because I need to update the UI so it needs to stay in the MainActivity class.
Anyhow, I need help to figure out why my ExecuteAsyncMethod() method doesn't compile.
Thank you!!