I have an AsyncTask GoogleBookAsyncTask that I want to run in a
Fragment. I am following this other SO
post. It requires my
Fragment class BookListingActivityFragment to implement an interface
AsyncResponse and declare its abstract method onProcessFinish().
The onProcessFinish() in my Fragment is declare as an anonymous
class life following.
public GoogleBookAsyncTask mGoogleBookAsyncTask = new GoogleBookAsyncTask(new AsyncResponse() {
@Override
public void processFinish(ArrayList<Book> bookArrayList) {
mBookArrayAdapter.clear();
mBookArrayAdapter = new BookAdapter(getContext(), bookArrayList);
mBookArrayAdapter.notifyDataSetChanged();
}
});
I get an error must either be declared abstract or implement abstract
method. This error goes away if I declare processFinish() as a
regular non-inner class. How can I resolve this error? I need to
execute mGoogleBookAsyncTask.execute() to get data from my AsyncTask
class.
The full source code my app can be found here.