[mono-android] Content Provider an Matrix Cursor

Jonathan Pryor jonp at xamarin.com
Wed Jan 4 13:32:07 EST 2012


On Dec 22, 2011, at 1:23 PM, caruso wrote:
>    // sampleList<sample> = new List<sample>();
>    // i fill sampleList with 100 entrys ID = the count and Name = count + "item"
> 
>    // in the on Query in the provider:
>        public override ICursor Query(Android.Net.Uri uri, string[]
> projection, string selection, string[] selectionArgs, string sortOrder)
>        {
>            int i = 0;
>            string[] ArtikelColumns = {"_id", "Name"};
>            MatrixCursor matrixCursor = new MatrixCursor(ArtikelColumns);
> 
>            for (i = 0; i < sampleList.Count; i ++)
>            {
>               matrixCursor.AddRow( sampleList[i].GetProjection() );

For marshaling purposes, this will convert the string[] into a Java.Lang.String[], which will be passed to Java. This is where the Java.Lang.String comes from...\

> // this gives me Back an Error cannot Convert from Java.Lang.String to 'string'

I don't see where you're getting this error, though. Is this a runtime error? Compile-time error? Where is it?

Thanks,
 - Jon



More information about the Monodroid mailing list