On Dec 10, 2011, at 12:13 AM, Nathan Blevins wrote:
> I had simple example that worked a few interations before the latest drop of
> Mono for Android. Basically, I have a class that queries the Booksmarks
> content provider and then adds those to a Simple Cursor Adapter.
...
> Whenever I attempt to run this piece of code, I get and Illegal Argument
> Exception, looking for an "_id" column. In some listsings, I have seen that
> the _ID column is required in the projection, though it was not the case
> previously. Any suggestions? (Log Dump Below)
I'm not able to reproduce on a Nexus One, and the following Activity works for
me:
[Activity (Label = "Scratch.DefaultTemplate", MainLauncher = true)]
public class Activity1 : ListActivity
{
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
var BookmarkCursor = ManagedQuery (Browser.BookmarksUri,
new String[] {
Browser.BookmarkColumns.Title,
Browser.BookmarkColumns.Url
},
null,
null,
null);
var SpinnerAdapter = new SimpleCursorAdapter (this,
Android.Resource.Layout.SimpleListItem1,
BookmarkCursor,
new string[] {
Browser.BookmarkColumns.Title },
new int[] { Android.Resource.Id.Text1
});
this.ListAdapter = SpinnerAdapter;
}
}
Note, however, that this project has the following permissions in
Properties\AndroidManifest.xml:
<uses-permission
android:name="android.permission.READ_HISTORY_BOOKMARKS" />
<uses-permission
android:name="com.android.browser.permission.READ_HISTORY_BOOKMARKS" />
(I have no idea why the latter permission is required, but that's what was
listed in exception output...)
Thanks,
- Jon
_______________________________________________
Monodroid mailing list
[email protected]
UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid