Code example for UriMatcher

Methods: addURImatch

0
 
	    /* 
	     * Sets the integer value for multiple rows in PoiTable to 1. Notice that no wildcard is used in the path 
	     * case 1: "content://org.ubicompforall.cityexplorer.provider/PoiTable 
	     */ 
	    sUriMatcher.addURI(AUTHORITY, POI_TABLE, 1);
 
	    /* 
	     * Sets the code for a single row (Poi) to 2. In this case, the "#" wildcard is used. 
	     * case 2: "content://org.ubicompforall.cityexplorer.provider/PoiTable/3" matches 
	     */ 
	    sUriMatcher.addURI(AUTHORITY, POI_TABLE+"/#", 2);
	     
	    // Select only matching addresses for a PoI  
	    if (selection == null) {
		    selection = "POI.address_id = ADDR._id"; // " AND POI.category_id = CAT._id";	    	
	    } else { 
		    selection = "POI.address_id = ADDR._id AND " + selection; // " AND POI.category_id = CAT._id";
	    } 
 
	    switch ( sUriMatcher.match(uri) ) {
			// If the incoming URI was for all of the PoiTable 
			case 1: 
			    if ( TextUtils.isEmpty(sortOrder) ) sortOrder = null; // _ID_COL + " ASC";
			    break;