Hi guys.  I've made a ton of attempts at getting a contentloader to work.  I am 
trying the following code, but am getting the exception listed below it.  Any 
help for this floundering person is greatly appreciated.  The exception appears 
to be database related, but I don't grok the meaning. Code:   [Activity(Label = 
"Content Loader Example", MainLauncher = true, Icon = "@drawable/icon")]
    public class Activity1 : ListActivity, LoaderManager.ILoaderCallbacks
    {
        // This is the Adapter being used to display the list's data.
        SimpleCursorAdapter mAdapter;        static String[] 
CONTACTS_SUMMARY_PROJECTION = new String[] {
            Android.Provider.ContactsContract.Contacts.InterfaceConsts.Id,
            Android.Provider.ContactsContract.ContactsColumns.PhotoId,
            Android.Provider.ContactsContract.ContactsColumns.LookupKey,
            Android.Provider.ContactsContract.ContactsColumns.DisplayName,
            
Android.Provider.ContactsContract.ContactStatusColumns.ContactStatus,
            Android.Provider.ContactsContract.StatusColumns.Status,
            Android.Provider.ContactsContract.StatusColumns.Presence,
        };        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);            // Set our view from the "main" 
layout resource
            //SetContentView(Resource.Layout.Main);            mAdapter = new 
SimpleCursorAdapter(this,
                Android.Resource.Layout.SimpleListItem2, null,
                new String[] { 
Android.Provider.ContactsContract.ContactsColumns.DisplayName, 
                                
Android.Provider.ContactsContract.ContactStatusColumns.ContactStatus },
                new int[] { Android.Resource.Id.Text1, 
Android.Resource.Id.Text2 }, 0);
            
            ListAdapter = mAdapter;            // Get our button from the 
layout resource,
            // and attach an event to it
            LoaderManager.InitLoader(0, bundle, this);        }        Loader 
LoaderManager.ILoaderCallbacks.OnCreateLoader(int id, Bundle args)
        {
            // This is called when a new Loader needs to be created.  This
            // sample only has one Loader, so we don't care about the ID.
            // First, pick the base URI to use depending on whether we are
            // currently filtering.
            Android.Net.Uri baseUri;
            
            baseUri = Contacts.ContentUri;            // Now create and return 
a CursorLoader that will take care of
            // creating a Cursor for the data being displayed.
            String selectWhere = "((" + 
ContactsContract.ContactsColumns.DisplayName + " NOTNULL) AND ("
                    + ContactsContract.ContactsColumns.HasPhoneNumber + "=1) 
AND ("
                    + ContactsContract.ContactsColumns.DisplayName + " != '' 
))";
            return new CursorLoader(this, baseUri,
                    CONTACTS_SUMMARY_PROJECTION, selectWhere, null,
                    ContactsContract.ContactsColumns.DisplayName + " COLLATE 
LOCALIZED ASC");
        }
        public void OnLoadFinished(Loader loader, Java.Lang.Object data)
        {
            // Swap the new cursor in.  (The framework will take care of 
closing the
            // old cursor once we return.)
            var d = (Android.Database.ICursor)data;
            mAdapter.SwapCursor(d);
        }        public void OnLoaderReset(Loader loader)
        {
            // This is called when the last Cursor provided to onLoadFinished()
            // above is about to be closed.  We need to make sure we are no
            // longer using it.
            mAdapter.SwapCursor(null);
        }
    }
 Exception Info:06-27 16:07:11.530 I/Process (  891): Sending signal. PID: 2563 
SIG: 3
06-27 16:07:11.530 I/dalvikvm( 2563): threadid=3: reacting to signal 3
06-27 16:07:11.530 I/dalvikvm( 2563): Wrote stack traces to 
'/data/anr/traces.txt'
06-27 16:07:12.045 I/Process (  891): Sending signal. PID: 2563 SIG: 3
06-27 16:07:12.045 I/dalvikvm( 2563): threadid=3: reacting to signal 3
06-27 16:07:12.050 I/dalvikvm( 2563): Wrote stack traces to 
'/data/anr/traces.txt'
06-27 16:07:12.531 I/Process (  891): Sending signal. PID: 2563 SIG: 3
06-27 16:07:12.531 I/dalvikvm( 2563): threadid=3: reacting to signal 3
06-27 16:07:12.531 I/dalvikvm( 2563): Wrote stack traces to 
'/data/anr/traces.txt'
06-27 16:07:13.053 I/Process (  891): Sending signal. PID: 2563 SIG: 3
06-27 16:07:13.053 I/dalvikvm( 2563): threadid=3: reacting to signal 3
06-27 16:07:13.061 I/dalvikvm( 2563): Wrote stack traces to 
'/data/anr/traces.txt'
06-27 16:07:13.551 I/Process (  891): Sending signal. PID: 2563 SIG: 3
06-27 16:07:13.551 I/dalvikvm( 2563): threadid=3: reacting to signal 3
06-27 16:07:13.551 I/dalvikvm( 2563): Wrote stack traces to 
'/data/anr/traces.txt'
06-27 16:07:14.051 I/Process (  891): Sending signal. PID: 2563 SIG: 3
06-27 16:07:14.051 I/dalvikvm( 2563): threadid=3: reacting to signal 3
06-27 16:07:14.051 I/dalvikvm( 2563): Wrote stack traces to 
'/data/anr/traces.txt'
06-27 16:07:14.551 I/Process (  891): Sending signal. PID: 2563 SIG: 3
06-27 16:07:14.551 I/dalvikvm( 2563): threadid=3: reacting to signal 3
06-27 16:07:14.551 I/dalvikvm( 2563): Wrote stack traces to 
'/data/anr/traces.txt'
06-27 16:07:15.053 I/Process (  891): Sending signal. PID: 2563 SIG: 3
06-27 16:07:15.053 I/dalvikvm( 2563): threadid=3: reacting to signal 3
06-27 16:07:15.053 I/dalvikvm( 2563): Wrote stack traces to 
'/data/anr/traces.txt'
06-27 16:07:15.561 I/Process (  891): Sending signal. PID: 2563 SIG: 3
06-27 16:07:15.561 I/dalvikvm( 2563): threadid=3: reacting to signal 3
06-27 16:07:15.561 I/dalvikvm( 2563): Wrote stack traces to 
'/data/anr/traces.txt'
06-27 16:07:15.631 D/gralloc_goldfish( 2563): Emulator without GPU emulation 
detected.
06-27 16:07:15.631 W/InputManagerService(  891): Starting input on non-focused 
client com.android.internal.view.IInputMethodClient$Stub$Proxy@b4a603a8 
(uid=10004 pid=1168)
06-27 16:07:15.671 E/DatabaseUtils( 1037): Writing exception to parcel
06-27 16:07:15.671 E/DatabaseUtils( 1037): java.lang.IllegalArgumentException: 
URI: content://contacts, calling user: 
ContentLoaderExample.ContentLoaderExample, calling 
package:ContentLoaderExample.ContentLoaderExample
06-27 16:07:15.671 E/DatabaseUtils( 1037):  at 
com.android.providers.contacts.LegacyApiSupport.query(LegacyApiSupport.java:1913)
06-27 16:07:15.671 E/DatabaseUtils( 1037):  at 
com.android.providers.contacts.ContactsProvider2.queryLocal(ContactsProvider2.java:5960)
06-27 16:07:15.671 E/DatabaseUtils( 1037):  at 
com.android.providers.contacts.ContactsProvider2.query(ContactsProvider2.java:4792)
06-27 16:07:15.671 E/DatabaseUtils( 1037):  at 
android.content.ContentProvider$Transport.query(ContentProvider.java:178)
06-27 16:07:15.671 E/DatabaseUtils( 1037):  at 
android.content.ContentProviderNative.onTransact(ContentProviderNative.java:112)
06-27 16:07:15.671 E/DatabaseUtils( 1037):  at 
android.os.Binder.execTransact(Binder.java:338)
06-27 16:07:15.671 E/DatabaseUtils( 1037):  at 
dalvik.system.NativeStart.run(Native Method)
06-27 16:07:15.671 W/dalvikvm( 2563): threadid=12: thread exiting with uncaught 
exception (group=0xb4196180)
06-27 16:07:15.671 E/AndroidRuntime( 2563): FATAL EXCEPTION: AsyncTask #1
06-27 16:07:15.671 E/AndroidRuntime( 2563): java.lang.RuntimeException: An 
error occured while executing doInBackground()
06-27 16:07:15.671 E/AndroidRuntime( 2563):  at 
android.os.AsyncTask$3.done(AsyncTask.java:278)
06-27 16:07:15.671 E/AndroidRuntime( 2563):  at 
java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273)
06-27 16:07:15.671 E/AndroidRuntime( 2563):  at 
java.util.concurrent.FutureTask.setException(FutureTask.java:124)
06-27 16:07:15.671 E/AndroidRuntime( 2563):  at 
java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)
06-27 16:07:15.671 E/AndroidRuntime( 2563):  at 
java.util.concurrent.FutureTask.run(FutureTask.java:137)
06-27 16:07:15.671 E/AndroidRuntime( 2563):  at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
06-27 16:07:15.671 E/AndroidRuntime( 2563):  at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
06-27 16:07:15.671 E/AndroidRuntime( 2563):  at 
java.lang.Thread.run(Thread.java:856)
06-27 16:07:15.671 E/AndroidRuntime( 2563): Caused by: 
java.lang.IllegalArgumentException: URI: content://contacts, calling user: 
ContentLoaderExample.ContentLoaderExample, calling 
package:ContentLoaderExample.ContentLoaderExample
06-27 16:07:15.671 E/AndroidRuntime( 2563):  at 
android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:166)
06-27 16:07:15.671 E/AndroidRuntime( 2563):  at 
android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:136)
06-27 16:07:15.671 E/AndroidRuntime( 2563):  at 
android.content.ContentProviderProxy.query(ContentProviderNative.java:358)
06-27 16:07:15.671 E/AndroidRuntime( 2563):  at 
android.content.ContentResolver.query(ContentResolver.java:311)
06-27 16:07:15.671 E/AndroidRuntime( 2563):  at 
android.content.CursorLoader.loadInBackground(CursorLoader.java:56)
06-27 16:07:15.671 E/AndroidRuntime( 2563):  at 
android.content.CursorLoader.loadInBackground(CursorLoader.java:42)
06-27 16:07:15.671 E/AndroidRuntime( 2563):  at 
android.content.AsyncTaskLoader.onLoadInBackground(AsyncTaskLoader.java:255)
06-27 16:07:15.671 E/AndroidRuntime( 2563):  at 
android.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:66)
06-27 16:07:15.671 E/AndroidRuntime( 2563):  at 
android.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:55)
06-27 16:07:15.671 E/AndroidRuntime( 2563):  at 
android.os.AsyncTask$2.call(AsyncTask.java:264)
06-27 16:07:15.671 E/AndroidRuntime( 2563):  at 
java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
06-27 16:07:15.671 E/AndroidRuntime( 2563):  ... 4 more
06-27 16:07:15.680 I/ActivityManager(  891): Displayed 
ContentLoaderExample.ContentLoaderExample/contentloaderexample.Activity1: 
+8s722ms
06-27 16:07:15.732 W/ActivityManager(  891):   Force finishing activity 
ContentLoaderExample.ContentLoaderExample/contentloaderexample.Activity1
06-27 16:07:15.732 W/WindowManager(  891): Failure taking screenshot for 
(180x300) to layer 21025
06-27 16:07:15.732 W/ActivityManager(  891):   Force finishing activity 
com.android.contacts/.activities.ContactDetailActivity
06-27 16:07:15.761 W/NetworkManagementSocketTagger(  891): 
setKernelCountSet(10004, 0) failed with errno -2
06-27 16:07:15.761 W/NetworkManagementSocketTagger(  891): 
setKernelCountSet(10004, 1) failed with errno -2
06-27 16:07:16.441 W/NetworkManagementSocketTagger(  891): 
setKernelCountSet(10049, 0) failed with errno -2
                                          
_______________________________________________
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid

Reply via email to