In the manifest of the application providing the content you would have:
<provider android:name="Inventory" android:authorities="com.package.name.Inventory" />
And in the application obtaining content
String inventoryItem = "dunno";
try {
Uri getItem = Uri.parse(
"content://com.package.name.Inventory/database_items");
String[] projection = new String[] { "text" };
Cursor cursor = managedQuery(getItem, projection, null, null, null);
if (null != cursor && cursor.moveToNext()) {
int index = cursor.getColumnIndex("text");
inventoryItem = cursor.getString(index));
}
cursor.close();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
In an external program, this would return the item listed under item_socks, but this is just a general example of having only one item listed with that name. You would be querying a database table named database_items that looks something like:
id | title | text
1 | item_socks | brown pair red stripe
inventoryItem would then be equal to "brown pair red stripe"