Code example for UriMatcher

Methods: addURI

0
    public static final String TITLE="title";
    public static final String VALUE="value";
  } 
 
  static { 
    MATCHER=new UriMatcher(UriMatcher.NO_MATCH);
    MATCHER.addURI("com.commonsware.android.constants.Provider",
                   "constants", CONSTANTS);
    MATCHER.addURI("com.commonsware.android.constants.Provider",
                   "constants/#", CONSTANT_ID);
  } 
 
  private DatabaseHelper db=null;
 
  @Override 
  public boolean onCreate() { 
    db=new DatabaseHelper(getContext());
 
    return((db == null) ? false : true);
  }