You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello
I am trying to create a content provider to get info from the database and display it in a listview but when I used the provider nothing diplayed in the list and I got this error in the logcat : 2019-02-02 14:06:38.195 1294-1331/com.example.android.pet E/ActivityThread: Failed to find provider info for com.example.android.pets
Hello
I am trying to create a content provider to get info from the database and display it in a listview but when I used the provider nothing diplayed in the list and I got this error in the logcat :
2019-02-02 14:06:38.195 1294-1331/com.example.android.pet E/ActivityThread: Failed to find provider info for com.example.android.pets
Here is the manifest:
`
`
and here is the query method in the provider:
private PetDbHelper petDbHelper; public static final String LOG_TAG = PetProvider.class.getSimpleName(); private static final int PETS = 100; private static final int PET_ID = 101; private static final UriMatcher sUriMatcher = new UriMatcher(UriMatcher.NO_MATCH); static { sUriMatcher.addURI(PetContract.CONTENT_AUTHORITY, PetContract.PATH_PETS, PETS); sUriMatcher.addURI(PetContract.CONTENT_AUTHORITY, PetContract.PATH_PETS + "/#", PET_ID); } @Override public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) { SQLiteDatabase database = petDbHelper.getReadableDatabase(); Cursor cursor; int match = sUriMatcher.match(uri); switch (match) { case PETS: cursor = database.query(PetContract.PetEntry.TABLE_NAME, projection, selection, selectionArgs, null, null, sortOrder); break; case PET_ID: selection = PetContract.PetEntry._ID + "=?"; selectionArgs = new String[] { String.valueOf(ContentUris.parseId(uri)) }; cursor = database.query(PetContract.PetEntry.TABLE_NAME, projection, selection, selectionArgs, null, null, sortOrder); break; default: throw new IllegalArgumentException("Cannot query unknown URI " + uri); } return cursor; }
Please help me , and thanks
The text was updated successfully, but these errors were encountered: