GetLoaderManager (). initLoader () does not accept 'this' as an argument, although the (ListFragment) class has no support libraries
I saw the previuos question
import android.app.ListFragment;
import android.app.LoaderManager.LoaderCallbacks;
import android.database.Cursor;
import android.os.Bundle;
import android.support.v4.app.LoaderManager;
import android.support.v4.content.Loader;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
public class Myfragment extends ListFragment implements
LoaderManager.LoaderCallbacks<Cursor> {
View v;
private int id = 1;
@Override
public void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
v = inflater.inflate(R.layout.job_layout, container);
getListView().setAdapter(new Jobs_Adapter());
return inflater.inflate(R.layout.job_layout, container);
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
// getLoaderManager().initLoader(id, null,
// (android.app.LoaderManager.LoaderCallbacks<Cursor>) this);
// Manager().initLoader(0, null,
// (android.app.LoaderManager.LoaderCallbacks<Cursor>) this);
getLoaderManager().initLoader(id, null,this);
}
@Override
public Loader<Cursor> onCreateLoader(int arg0, Bundle arg1) {
return null;
}
@Override
public void onLoadFinished(Loader<Cursor> arg0, Cursor arg1) {
// TODO Auto-generated method stub
}
@Override
public void onLoaderReset(Loader<Cursor> arg0) {
// TODO Auto-generated method stub
}
}
I've seen all the related questions suggesting to use support libraries, but what if someone doesn't want to use support libraries and is it recommended ?. I am using a separate Fragment instead of using it inside FragmentActivity
+3
dreamer1989
source
to share
1 answer
The problem is you are mixing normal / maintainer classes. Since you don't want to use the support library, just replace
import android.support.v4.app.LoaderManager;
import android.support.v4.content.Loader;
from
import android.app.LoaderManager;
import android.content.Loader;
+3
Salem
source
to share