I am a novice Android programmer experimenting with AsyncTask and performing HTTP requests. My goal is to be able to perform the HTTP request using AsyncTask. My AsyncTask is below:
private class DownloadFilesTask extends AsyncTask<String, Void, Void> {
@Override
protected void onPreExecute() {
super.onPreExecute();
}
@Override
protected List<Book> doInBackground(String... params) {
return Network.getBookData(params[0]);
}
@Override
protected void onProgressUpdate(Void... values) {
super.onProgressUpdate(values);
}
@Override
protected void onPostExecute(Void result) {
super.onPostExecute(result);
}
}
There is an error that says in the doInBackground(String... params)
method, there is an attempt to use an incompatible return type. How can I fix this and still have the method return a List<Book>
?