Code example for UriMatcher

Methods: addURI

public class TestTargetContentProvider extends ContentProvider {
    public static final String AUTHORITY = "jp.mixi.sample.test.testtargetcontentprovider";
    public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/tests");
    public static final String TAG = TestTargetContentProvider.class.getSimpleName();
    private static final UriMatcher URI_MATCHER = new UriMatcher(UriMatcher.NO_MATCH);
    private static final String CONTENT_TYPE_TEST_ITEMS = "";
    private static final String CONTENT_TYPE_TEST_ITEM = "";
    private static final int TYPE_ITEMS = 1;
    private static final int TYPE_ITEM = 2;
    private SQLiteOpenHelper mDatabaseHelper;
    // static initializer, which should be run at class loading 
    static { 
        URI_MATCHER.addURI(AUTHORITY, "tests/#", TYPE_ITEM);
    public int delete(Uri uri, String selection, String[] selectionArgs) {
        SQLiteDatabase db = null;
Connect your IDE to all the code out there  Get Codota for Java