I have a simple fragment, trying to implement AsyncTaskLoader in it. But i am getting one compile time error :
error: incompatible types required: Loader< List< String>> found: LoaderDrone
the error is in the onCreateLoader method. what am i missing ?
After some research i am unable to find the solution.
here is the code
public class SubPlaceFragment extends Fragment implements LoaderManager.LoaderCallbacks<List<String>> {
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
getLoaderManager().initLoader(0, null, this);
getLoaderManager().getLoader(0).startLoading();
}
@Override
public Loader<List<String>> onCreateLoader(int id, Bundle args) {
return new LoaderDrone(getActivity());
}
@Override
public void onLoadFinished(Loader<List<String>> loader, List<String> data) {
}
@Override
public void onLoaderReset(Loader<List<String>> loader) {
}
public static class LoaderDrone extends AsyncTaskLoader<List<String>> {
public LoaderDrone(Context context) {
super(context);
onForceLoad();
}
@Override
public List<String> loadInBackground() {
List<String> results = null;
return results;
}
}
}
Thanks for the help :)