ContentProvider.Query - How to select the table I wan't using URIs?
<p>I'm currently facing a database query issue. I have two tables, <strong>items</strong> and <strong>details</strong> with the following schema definition:</p>

<pre><code>    items(_id, title, type)                        &lt;--- _id is primary key
    details(_id, _itemid, name, quantity, dosis)   &lt;--- _id is primary key. _itemid is foreign key
</code></pre>

<p>Furthermore I access my database via. my own contentProvider. In my activity I want to query the details table to get all tuples, however Im not sure how to "get" the table using URI's. My query is:</p>

<pre><code>  Uri subItems = Uri.parse("content://tod.dosetracker.provider.Food");
  Cursor c = getContentResolver().query(
            subItems, 
            new String[] {"*"}, 
            "_itemid = " + _id, 
            null, 
            null);
</code></pre>

<p>In my ContentProvider class I have the following (extract):</p>

<pre><code>    public static final String PROVIDER_NAME = "tod.dosetracker.provider.Food";
    public static final Uri CONTENT_URI_ITEMS = Uri.parse("content://" + PROVIDER_NAME + "/items");
    public static final Uri CONTENT_URI_DETAILS = Uri.parse("content://" + PROVIDER_NAME + "/details");

    public static final String _ID = "_id";
    public static final String _ITEMID = "_itemid";
    public static final String TITLE = "title";
    public static final String TYPE = "type";
    public static final String NAME = "name";
    public static final String DOSIS = "dosis";
    public static final String QUANTITY = "quantity";

    private static final int ITEM = 1;
    private static final int ITEM_ID = 2;
    private static final int DETAILS = 3;
    private static final int DETAILS_ID = 4;

    // URI resource matchers
    private static final UriMatcher uriMatcher;
    static {
    uriMatcher = new UriMatcher(UriMatcher.NO_MATCH);
    uriMatcher.addURI(PROVIDER_NAME, "items", ITEM);
    uriMatcher.addURI(PROVIDER_NAME, "items/#", ITEM_ID);
    uriMatcher.addURI(PROVIDER_NAME, "details", DETAILS);
    uriMatcher.addURI(PROVIDER_NAME, "details/#", DETAILS_ID);
    }

    // Database reference name
    private SQLiteDatabase foodDB;
</code></pre>
