jeudi 30 juillet 2015

The constructor CursorLoader is undefined

I am trying to retrieve rows of locations from my SQLiteTable but I ran into a compilation error, the constructor CursorLoader is undefined. What can I do to resolve this error?

@Override
public Loader<Cursor> onCreateLoader(int arg0,
    Bundle arg1) {

    // Uri to the content provider LocationsContentProvider
    Uri uri = LocationsContentProvider.CONTENT_URI;

    // Fetches all the rows from locations table

    //return new CursorLoader(null);
   //(Context context, Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder)

    /ERROR HERE
    return new CursorLoader(this, null, null null, null);
}

In LocationsContentProvider.java

 /** A callback method which is invoked by default content uri */
@Override
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {

    if(uriMatcher.match(uri)==LOCATIONS){
        return mLocationsDB.getAllLocations();
    }
    return null;
}

Aucun commentaire:

Enregistrer un commentaire