I have a public class FriendMaps extends MapActivity that gets called from a menu item when selected, and at the end of that I have private abstract class DownloadFilesTask extends AsyncTask<Void, Void, Void> in there I do some server calls and put data into local arrays etc.
But in my public void onCreate(Bundle savedInstanceState) of the FriendMaps activity I call new DownloadFilesTask().execute(); and get the following error:
Error: Cannot instantiate the type
FriendMaps.DownloadFilesTask
From the documentation:
AsyncTask must be subclassed to be used.
That would be accomplished DownloadFilesTask extends AsyncTask there.
The task instance must be created on the UI thread
Maybe this is where I am confused? To my understanding the UI thread is the current activity being displayed – if so then the onCreate of the FriendMaps activity is the correct place to execute();
If full code spinets are required for further help, please comment and I’ll add where needed.
You can’t instantiate it because you declared
DownloadFilesTaskas an abstract class, that, by definition, cannot be instantiated