Android UriMatcher - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android UriMatcher class.

This code example shows how to use the following methods:match
 
    return(count);
  } 
 
  private boolean isCollectionUri(Uri url) {
    return(MATCHER.match(url) == CONSTANTS);
  } 
} 
9
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:match
 
    return(count);
  } 
 
  private boolean isCollectionUri(Uri url) {
    return(MATCHER.match(url) == CONSTANTS);
  } 
} 
9
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:match
 
    return(count);
  } 
 
  private boolean isCollectionUri(Uri url) {
    return(MATCHER.match(url) == CONSTANTS);
  } 
} 
9
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:addURI
    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);
  } 
8
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:addURI
        throw new UnsupportedOperationException();
    } 
 
    private UriMatcher buildUriMatcher(Context context) {
        String authority = getAuthority(context);
        UriMatcher matcher = new UriMatcher(UriMatcher.NO_MATCH);
        matcher.addURI(authority, SearchManager.SUGGEST_URI_PATH_QUERY,
                SEARCH_SUGGEST);
        matcher.addURI(authority, SearchManager.SUGGEST_URI_PATH_QUERY + "/*",
                SEARCH_SUGGEST);
        matcher.addURI(authority, SearchManager.SUGGEST_URI_PATH_SHORTCUT,
                SEARCH_SHORTCUT);
        matcher.addURI(authority, SearchManager.SUGGEST_URI_PATH_SHORTCUT + "/*",
                SEARCH_SHORTCUT);
        return matcher;
    } 
 
    protected String getAuthority(Context context) {
        return context.getPackageName() + ".google";
    } 
8
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:addURI
    private static final int SEARCH_SUGGEST = 2;
     
    private static final UriMatcher matcher = buildUriMatcher();
     
    private static UriMatcher buildUriMatcher() {
        UriMatcher umatcher = new UriMatcher(UriMatcher.NO_MATCH);
 
        umatcher.addURI(AUTHORITY, "sonnets", SEARCH);
        umatcher.addURI(AUTHORITY, "sonnets/#", GET_SONNET);
         
        umatcher.addURI(AUTHORITY, 
        				SearchManager.SUGGEST_URI_PATH_QUERY, 
        				SEARCH_SUGGEST);
        umatcher.addURI(AUTHORITY, 
        				SearchManager.SUGGEST_URI_PATH_QUERY + "/*", 
        				SEARCH_SUGGEST);
         
        return umatcher;
    } 
	 
8
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:match
This code example shows how to use the following methods:addURI
    private static final int DIR = 1;
    private static final int FILE_NAME = 2;
 
    private static final UriMatcher uriMatcher;
    static { 
        uriMatcher = new UriMatcher(UriMatcher.NO_MATCH);
           uriMatcher.addURI(PROVIDER_NAME, "dir", DIR);
           uriMatcher.addURI(PROVIDER_NAME, "file", FILE_NAME);
        } 
 
    public int PruneDir(String sTmpDir) {
        int    nRet = 0;
        int nFiles = 0;
        String sSubDir = null;
 
        File dir = new File(sTmpDir);
 
        if (dir.isDirectory()) {
            File [] files = dir.listFiles();
            if (files != null) {
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:addURI
			+ "/" + TABLE_ROSTER);
	public static final Uri GROUPS_URI = Uri.parse("content://" + AUTHORITY
			+ "/" + TABLE_GROUPS);
	public static final String QUERY_ALIAS = "main_result";
 
	private static final UriMatcher URI_MATCHER = new UriMatcher(
			UriMatcher.NO_MATCH);
	private static final int CONTACTS = 1;
	private static final int CONTACT_ID = 2;
	private static final int GROUPS = 3;
	private static final int GROUP_MEMBERS = 4;
 
	static { 
		URI_MATCHER.addURI(AUTHORITY, "roster", CONTACTS);
		URI_MATCHER.addURI(AUTHORITY, "roster/#", CONTACT_ID);
		URI_MATCHER.addURI(AUTHORITY, "groups", GROUPS);
		URI_MATCHER.addURI(AUTHORITY, "groups/*", GROUP_MEMBERS);
	} 
 
	private static final String TAG = "yaxim.RosterProvider";

8
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:match
 
    return(count);
  } 
 
  private boolean isCollectionUri(Uri url) {
    return(MATCHER.match(url) == CONSTANTS);
  } 
} 
9
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java

Related Android UriMatcher Questions & Answers:

See Code Examples for Android UriMatcher Methods: