У меня есть следующий блок кода на основе асинхронной задачи.
Я пытаюсь вернуть переменную List через return LoadFeed ()
и тип возвращаемого значения doInBackground - String.
Если я изменю тип возврата doInBackground с String на List
тогда я получаю ошибку
"The return type is incompatible with AsyncTask<String,Void,String>.doInBackground(String[])"
Как мне исправить эту ошибку?
Пожалуйста, помогите
Спасибо
private class DispData extends AsyncTask<String, Void, String> {
private final ProgressDialog dialog = new ProgressDialog(MessageList.this);
// can use UI thread here
protected void onPreExecute() {
dialog.setMessage("Fetching scores...");
dialog.show();
}
// automatically done on worker thread (separate from UI thread)
protected String doInBackground(final String... args) {
return loadFeed();
}
// can use UI thread here
protected void onPostExecute(final List<String> result) {
if (dialog.isShowing()) {
dialog.dismiss();
}
adapter =
new ArrayAdapter<String>(MessageList.this,R.layout.row,result);
MessageList.this.setListAdapter(adapter);
}
}