Code example for UriMatcher

Methods: addURI

0
    public static final Uri AUTHORITY_URI = Uri.parse("content://" + AUTHORITY);
 
    static final String TABLE_SNAPSHOTS = "snapshots";
    static final int SNAPSHOTS = 10;
    static final int SNAPSHOTS_ID = 11;
    static final UriMatcher URI_MATCHER = new UriMatcher(UriMatcher.NO_MATCH);
 
    SnapshotDatabaseHelper mOpenHelper;
 
    static { 
        URI_MATCHER.addURI(AUTHORITY, "snapshots", SNAPSHOTS);
        URI_MATCHER.addURI(AUTHORITY, "snapshots/#", SNAPSHOTS_ID);
    } 
 
    final static class SnapshotDatabaseHelper extends SQLiteOpenHelper {
 
        static final String DATABASE_NAME = "snapshots.db";
        static final int DATABASE_VERSION = 2;
 
        public SnapshotDatabaseHelper(Context context) {
            super(context, getFullDatabaseName(context), null, DATABASE_VERSION);