views:

66

answers:

1

Hey folks! Im having problems with the content provider. Im trying to create a content provider.

  1. Is my URI parse been parse correctly?

public static final Uri CONTENT_URI = Uri.parse("content://data/data/one.two/databases");

this leads to my database as I want to extract data from it and show it in the list view. after which, i have to edit the manifest inserting the provider

  1. if I extend my class to ContentProvider, my database file will be kinda screwed up, is there an easier way?

however, it shows the error of not having the one.two.databases to exist. i kinda stuck here. please help!

THANKS ALOT.

+1  A: 

You may want to start here:

http://developer.android.com/guide/topics/providers/content-providers.html

A few specific tips to help:

First, your URI is not a path to the database file. It starts with "content://", then has an authority, then finally the database name (typically).

Your authority is a name you provide, usually your package name with 'provider' on the end. So yours might be one.two.provider.

Then you'd make a new class in your project, like MyProvider.java. Follow the example at the link up there for what to do in your provider to actually provide data.

Finally, in your AndroidManifest.xml file you'd do something like this:

<provider
    android:authorities="one.two.provider"
    android:name="MyProvider"
></provider>

This tells the android OS to hook your authority (one.two.provider) up to your class.

Keith Twombley
Ive created my own Content Provider already. But however, it still doesn't work and doesn't show my list view. What should I write for this? public static final String CONTENT_TYPE = null;i dont think its null.
UserA