I was wondering if AsyncTask was made to be used inside the main activity (MainActivity.java) running the thread.

For example I noticed many tutorials when using the AsyncTask they declare a private class inside the main class extending the Activity rather than creating an independent .java file for that AsyncTask (MyAsyncTask.java) class.

But I noticed that when using an independent file i'm not being able to run the runOnUIThread() because it belongs to the Activity class, so how will i be able to use this method inside that independent AsyncTask (MyAsyncTask.java) which extends AsyncTask and not Activity.

Edit
Report