Я получаю имя и идентификатор электронной почты контактов, и он отлично работает в HTC Desire, но всякий раз, когда я пытался запустить код на вкладке galaxy, он показывает, что в memObj нет памяти, а указатель null включен ... while (emailCur .moveToNext ()).
Вот мой код
private void getPeopleList() {
String name, email;
Runtime.getRuntime().maxMemory();
c = cr.query(ContactsContract.Contacts.CONTENT_URI, null, null, null, null);
if (c.getCount() > 0) {
while (c.moveToNext()) {
name = c.getString(c
.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME));
String id = c.getString(c
.getColumnIndex(BaseColumns._ID));
cr.query(
ContactsContract.CommonDataKinds.Phone.CONTENT_URI,
null,
ContactsContract.CommonDataKinds.Phone.CONTACT_ID
+ " = ?", new String[] { id }, null);
emailCur = cr.query(Email.CONTENT_URI, null,
Email.CONTACT_ID + " = " + id, null, null);
int j = 0;
while (emailCur.moveToNext()) {
bindData = new BindData[emailCur.getCount()];
bindData = new BindData();
email = emailCur
.getString(emailCur
.getColumnIndex(ContactsContract.CommonDataKinds.Email.DATA));
bindData.setEmailId(email);
bindData.setName(name);
Log.d("doubt : ", name+"//"+email);
mArrayList.add(bindData);
j++;
}
emailCur.close();
}
c.close();
}
}
Я вызываю этот метод, используя рабочий поток, работающий.
Если требуется какая-либо информация, дайте мне знать.
вот мой бревенчатый кот
06-29 16:13:26.854: ERROR/IMemory(6180): binder=0xdf3f68 transaction failed fd=-2147483647, size=0, err=-2147483646 (Unknown error: 2147483646)
06-29 16:13:26.854: ERROR/IMemory(6180): cannot dup fd=-2147483647, size=0, err=-2147483646 (Bad file number)
06-29 16:13:26.854: ERROR/IMemory(6180): cannot map BpMemoryHeap (binder=0xdf3f68), size=0, fd=-1 (Bad file number)
06-29 16:13:26.854: ERROR/JavaBinder(6180): *** Uncaught remote exception! (Exceptions are not yet supported across processes.)
06-29 16:13:26.854: ERROR/JavaBinder(6180): java.lang.RuntimeException: No memory in memObj
06-29 16:13:26.854: ERROR/JavaBinder(6180): at android.database.CursorWindow.native_init(Native Method)
06-29 16:13:26.854: ERROR/JavaBinder(6180): at android.database.CursorWindow.<init>(CursorWindow.java:518)
06-29 16:13:26.854: ERROR/JavaBinder(6180): at android.database.CursorWindow.<init>(CursorWindow.java:27)
06-29 16:13:26.854: ERROR/JavaBinder(6180): at android.database.CursorWindow$1.createFromParcel(CursorWindow.java:493)
06-29 16:13:26.854: ERROR/JavaBinder(6180): at android.database.CursorWindow$1.createFromParcel(CursorWindow.java:496)
06-29 16:13:26.854: ERROR/JavaBinder(6180): at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:103)
06-29 16:13:26.854: ERROR/JavaBinder(6180): at android.os.Binder.execTransact(Binder.java:288)
06-29 16:13:26.854: ERROR/JavaBinder(6180): at dalvik.system.NativeStart.run(Native Method)
06-29 16:13:26.858: ERROR/AndroidRuntime(6388): FATAL EXCEPTION: main
06-29 16:13:26.858: ERROR/AndroidRuntime(6388): java.lang.NullPointerException
06-29 16:13:26.858: ERROR/AndroidRuntime(6388): at com.meomyo.fanaticfaninit.utils.MyCustomList.getPeopleList(MyCustomList.java:172)
06-29 16:13:26.858: ERROR/AndroidRuntime(6388): at com.meomyo.fanaticfaninit.utils.MyCustomList.access$0(MyCustomList.java:144)
06-29 16:13:26.858: ERROR/AndroidRuntime(6388): at com.meomyo.fanaticfaninit.utils.MyCustomList$1.run(MyCustomList.java:121)
06-29 16:13:26.858: ERROR/AndroidRuntime(6388): at android.os.Handler.handleCallback(Handler.java:587)
06-29 16:13:26.858: ERROR/AndroidRuntime(6388): at android.os.Handler.dispatchMessage(Handler.java:92)
06-29 16:13:26.858: ERROR/AndroidRuntime(6388): at android.os.Looper.loop(Looper.java:123)
06-29 16:13:26.858: ERROR/AndroidRuntime(6388): at android.app.ActivityThread.main(ActivityThread.java:4627)
06-29 16:13:26.858: ERROR/AndroidRuntime(6388): at java.lang.reflect.Method.invokeNative(Native Method)
06-29 16:13:26.858: ERROR/AndroidRuntime(6388): at java.lang.reflect.Method.invoke(Method.java:521)
06-29 16:13:26.858: ERROR/AndroidRuntime(6388): at