@@ -0,0 +1,3130 @@
+package com.example.georgekaraolanis.project10_inventoryapp.data;%0A%0Aimport android.content.ContentProvider;%0Aimport android.content.ContentUris;%0Aimport android.content.ContentValues;%0Aimport android.content.UriMatcher;%0Aimport android.database.Cursor;%0Aimport android.database.sqlite.SQLiteDatabase;%0Aimport android.net.Uri;%0A%0Aimport com.example.georgekaraolanis.project10_inventoryapp.data.InventoryContract.InventoryEntry;%0A%0Apublic class InventoryItemProvider extends ContentProvider%7B%0A%0A    /*tag for logging*/%0A    public static final String LOG_TAG = InventoryItemProvider.class.getSimpleName();%0A%0A    /*URI matcher code for list of items */%0A    private static final int ITEMS = 100;%0A%0A    /*URI matcher code for one item */%0A    private static final int ITEM_ID = 101;%0A%0A    /*URI matcher*/%0A    private static final UriMatcher uriMatcher = new UriMatcher(UriMatcher.NO_MATCH);%0A%0A    /*Static initializer for what uris the matcher should recognize as accepted*/%0A    static %7B%0A        uriMatcher.addURI(InventoryContract.CONTENT_AUTHORITY, InventoryContract.PATH_INVENTORY, ITEMS);%0A        uriMatcher.addURI(InventoryContract.CONTENT_AUTHORITY, InventoryContract.PATH_INVENTORY + %22/#%22, ITEM_ID);%0A    %7D%0A%0A    /*The db helper object*/%0A    private InventoryDbHelper dbHelper;%0A%0A    @Override%0A    public boolean onCreate() %7B%0A        dbHelper = new InventoryDbHelper(getContext());%0A        return true;%0A    %7D%0A%0A    @Override%0A    public Cursor query(Uri uri,String%5B%5D projection,String selection, String%5B%5D selectionArgs, String sortOrder) %7B%0A%0A        /*Get readable database*/%0A        SQLiteDatabase database = dbHelper.getReadableDatabase();%0A%0A        /*Cursor to return*/%0A        Cursor cursor;%0A%0A        /*Get the match from the uri matcher*/%0A        int match = uriMatcher.match(uri);%0A%0A        /*Check the match*/%0A        switch (match) %7B%0A            case ITEMS:%0A                cursor = database.query(InventoryEntry.TABLE_NAME, projection, selection, selectionArgs,%0A                        null, null, sortOrder);%0A                break;%0A            case ITEM_ID:%0A                selection = InventoryEntry._ID + %22=?%22;%0A                selectionArgs = new String%5B%5D %7B String.valueOf(ContentUris.parseId(uri)) %7D;%0A%0A                cursor = database.query(InventoryEntry.TABLE_NAME, projection, selection, selectionArgs,%0A                        null, null, sortOrder);%0A                break;%0A            default:%0A                throw new IllegalArgumentException(%22Cannot query unknown URI %22 + uri);%0A        %7D%0A%0A        /*Set notification uri on cursor. If the uri changes, we need to change cursor*/%0A        cursor.setNotificationUri(getContext().getContentResolver(),uri);%0A%0A        /*Return the cursor*/%0A        return cursor;%0A    %7D%0A%0A    @Override%0A    public String getType(Uri uri) %7B%0A        return null;%0A    %7D%0A%0A    @Override%0A    public Uri insert(Uri uri,ContentValues values) %7B%0A        return null;%0A    %7D%0A%0A    @Override%0A    public int delete(Uri uri,String selection,String%5B%5D selectionArgs) %7B%0A        return 0;%0A    %7D%0A%0A    @Override%0A    public int update(Uri uri,ContentValues values,String selection,String%5B%5D selectionArgs) %7B%0A        return 0;%0A    %7D%0A%7D%0A

Create ContentProvider and implement query and onCreate method