I'm trying to build my first ContentProvider using the example in Mark's
book "A Busy Coder's Guide To Android Development" (which I suggest other
n00bs like me should read :-).
My database is created; I can go in via the command line/SQLite interface
and play with it. The database name is lbtdl.db and the only table in it is
"locations".
However, when I do the following:
locationsCursor = managedQuery(Provider.Locations.CONTENT_URI,
FIELDS, null, null, null);
ListAdapter adapter = new SimpleCursorAdapter(this,
R.layout.listlocations,
locationsCursor,
new String[] {
Provider.Locations.NAME},
new int[] {R.id.name
});
setListAdapter(adapter);
selection= (TextView)findViewById(R.id.selection);
locationsCursor is alway null, nothing is displayed, and logcat complains
"E/ActivityThread( 387): Failed to find provider info for
com.appspot.lbtdl"
I can't figure out what the right combination of things is to make this
work. In my Provider.java file (which I stol^H^H^H^H borrowed from Mark's
book), I have the following:
public class Provider extends ContentProvider {
private static final String DATABASE_NAME="lbtdl.db";
private static final int LOCATIONS=1;
yada yada yada
and
public static final class Locations implements BaseColumns {
public static final Uri
CONTENT_URI=Uri.parse("content://com.appspot.lbtdl");
yada yada yada
and
static {
MATCHER=new UriMatcher(UriMatcher.NO_MATCH);
MATCHER.addURI("com.appspot.lbtdl.", "locations", LOCATIONS);
yada yada yada
And various permutations of the above but my Activity can't find the
ContentProvider.
What am I doing wrong?
--
Faber Fedor
Cloud Computing New Jersey
http://cloudcomputingnj.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---