Code example for UriMatcher

Methods: addURI

0
public class SettingsProvider extends ContentProvider {
    public static final String AUTHORITY = "com.cyanogenmod.cmparts.provider.Settings";
    public static final String TABLE_NAME = "settings";
    public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/" + TABLE_NAME);
 
    private static final UriMatcher URI_MATCHER = new UriMatcher(UriMatcher.NO_MATCH);	 
 
    private static final int SETTINGS = 1;
    private static final int SETTINGS_ID = 2;
 
    static { 
        URI_MATCHER.addURI(AUTHORITY, "settings", SETTINGS);
        URI_MATCHER.addURI(AUTHORITY, "settings/#", SETTINGS_ID);
    } 
 
    private static final String TAG = "SettingsProvider";
 
    private SQLiteOpenHelper mOpenHelper;
 
    @Override