Last active
September 15, 2018 18:07
-
-
Save barmgeat/3fb5278e262c5d6ed5ee7b30eb58d85d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AppProvider extends ContentProvider { | |
private static final UriMatcher uriMatcher = new UriMatcher(UriMatcher.NO_MATCH); | |
static { | |
/* | |
* The calls to addURI() go here, for all of the content URI patterns that the provider | |
* should recognize. For this snippet, only the calls for table 3 are shown. | |
*/ | |
/* | |
* Sets the integer value for multiple rows in table 3 to 1. Notice that no wildcard is used | |
* in the path | |
*/ | |
uriMatcher.addURI("com.example.android.AppName", "words", 1); | |
/* | |
* Sets the code for a single row to 2. In this case, the "#" wildcard is | |
* used. "content://com.example.android.AppName/words/3" matches, but | |
* "content://com.example.android.AppName/words doesn't. | |
*/ | |
uriMatcher.addURI("com.example.app.provider", "words/#", 2); | |
} | |
.... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment