我有一个扩展AsyncTask的类,它必须实现doInBackground方法。 我有下面定义的方法,我仍然有一个错误,说类必须实现方法。
public class MyDownloadJsonAsyncTask extends AsyncTask<Void , String, Bitmap> {
private final WeakReference<RecyclerView_Adapter> adapterReference;
MovieDataJson movieData;
public MyDownloadJsonAsyncTask(RecyclerView_Adapter adapter)
{
adapterReference = new WeakReference<RecyclerView_Adapter>(adapter);
}
@Override
protected MovieDataJson doInBackground(String... urls)
{
MovieDataJson threadMovieData = new MovieDataJson();
for (String url : urls)
{
threadMovieData.downloadMovieDataJson(url);
}
return threadMovieData;
}
@Override
protected void onPostExecute(MovieDataJson threadMovieData)
{
movieData.moviesList.clear();
for(int i=0;i<threadMovieData.getSize();i++)
{
movieData.moviesList.add(threadMovieData.moviesList.get(i));
}
if(adapterReference!=null)
{
final RecyclerView_Adapter adapter= adapterReference.get();
if(adapter!=null)
adapter.notifyDataSetChanged();
}
}
}
并且@Override对于上面的每个方法都表示方法不会覆盖其超类
中的方法