Skip to content

Instantly share code, notes, and snippets.

@nikhilbansal97
Created September 16, 2017 17:53
Show Gist options
  • Save nikhilbansal97/ff6a2ec4a6a0c9c5fe976defd3c57d98 to your computer and use it in GitHub Desktop.
Save nikhilbansal97/ff6a2ec4a6a0c9c5fe976defd3c57d98 to your computer and use it in GitHub Desktop.
package com.example.nikhil.schematiclibrary.provider;
import android.net.Uri;
import net.simonvt.schematic.annotation.ContentProvider;
import net.simonvt.schematic.annotation.ContentUri;
import net.simonvt.schematic.annotation.InexactContentUri;
import net.simonvt.schematic.annotation.TableEndpoint;
/**
* This is the content provider for the database.
*/
@ContentProvider(authority = Provider.AUTHORITY,database = DatabaseClass.class)
public class Provider {
public static final String AUTHORITY = "com.example.nikhil.schematiclibrary.provider";
@TableEndpoint(table = DatabaseClass.CONTRACT_TABLE)
public static class ContractTable{
@ContentUri(
path = "contract",
type = "vnd.android.cursor.dir",
defaultSort = ContractClass.COLUMN_ID + " ASC")
public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/contract");
@InexactContentUri(
path = "contract/#",
name = "LIST_ID",
type = "vnd.android.cursor.item",
whereColumn = ContractClass.COLUMN_ID,
pathSegment = 1)
public static Uri withId(long id){
return Uri.parse("content://" + AUTHORITY + "/contract/" + id);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment