Code example for UriMatcher

Methods: addURImatch

0
        return null;  //To change body of implemented methods use File | Settings | File Templates. 
    } 
 
    @Override 
    public Uri insert(Uri uri, ContentValues contentValues) {
        UriMatcher uriMatcher = new UriMatcher(UriMatcher.NO_MATCH);
        uriMatcher.addURI(AUTHORITY, Task.TABLE_NAME, 1);
        if (uriMatcher.match(uri) == 1) {
            ContentValues values;
            if (contentValues != null) {
                values = new ContentValues(contentValues);
            } else { 
                values = new ContentValues();
            } 
 
            SQLiteDatabase db = dbHelper.getWritableDatabase();
            long rowId = db.insert(Task.TABLE_NAME, null, values);
            if (rowId > 0) {
                Uri taskUri = ContentUris.withAppendedId(CONTENT_URI, rowId);
                getContext().getContentResolver().notifyChange(taskUri, null);
Connect your IDE to all the code out there  Get Codota for Java