Skip to content

Instantly share code, notes, and snippets.

@Axxiss
Created May 4, 2012 09:24
Show Gist options
  • Save Axxiss/2593560 to your computer and use it in GitHub Desktop.
Save Axxiss/2593560 to your computer and use it in GitHub Desktop.
Memmers of AcmeProvider
//Authority and ContentProvier URI
public static final String AUTHORITY = "com.acme.provider.myapp";
public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/logs");
//differentiate between the different URI requests
private static final int LOG_LIST = 1;
private static final int LOG_ITEM = 2;
//content types
private static final String CONTENT_TYPE_LIST = "vnd.android.cursor.dir/vnd.myapp.logs";
private static final String CONTENT_TYPE_ITEM = "vnd.android.cursor.item/vnd.myapp.logs";
//database file and properties
private SQLiteDatabase dbLogs = null;
private static final String DB_NAME= "logs.db";
private static final int DB_VERSION = 1;
private static final String TABLE_NAME = "logs";
//table columns
public static final String KEY_ID ="_id";
public static final String KEY_FILENAME ="filename";
//table index
public static final int INDEX_ID = 0;
public static final int INDEX_FILENAME = 1;
private static final UriMatcher uriMatcher;
static{
uriMatcher = new UriMatcher(UriMatcher.NO_MATCH);
uriMatcher.addURI(AUTHORITY, "logs", LOG_LIST);
uriMatcher.addURI(AUTHORITY, "logs/#", LOG_ITEM);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment