我在从电话簿中获取联系人时遇到内存问题,下面是我的代码,我正在 OS 4+ 中对其进行测试
Cursor cursor =managedQuery(ContactsContract.Contacts.CONTENT_URI,
new String[]{Data._ID,"display_name","photo_id","starred"},
null, null, "UPPER(" + ContactsContract.Contacts.DISPLAY_NAME + ") ASC , "
+ ContactsContract.Contacts.HAS_PHONE_NUMBER+ " DESC" );
Cursor pCur;
Cursor emailCur;
while(cursor.moveToNext()) {
pCur = WP7Main.this.managedQuery(
ContactsContract.CommonDataKinds.Phone.CONTENT_URI,
projPhone, ContactsContract.CommonDataKinds.Phone.CONTACT_ID
+ " = ?", new String[] { id }, null);
}
我在 asyncTask 中执行此操作,它有近 700 多个联系人
我得到以下错误
E/CursorWindow(25078): Could not create CursorWindow from Parcel due to error -12.
W/dalvikvm(25078): threadid=14: thread exiting with uncaught exception (group=0x40c66930)
E/AndroidRuntime(25078): FATAL EXCEPTION: AsyncTask #3
E/AndroidRuntime(25078): java.lang.RuntimeException: An error occured while executing doInBackground()
E/AndroidRuntime(25078): at android.os.AsyncTask$3.done(AsyncTask.java:299)*
我该如何解决这个问题?