我一直在AlertDialog显示联系人的问题,我想我已经找到了 的问题,但我仍然感到困惑。我的代码的相关犯罪嫌疑人的部分是:SimpleCursorAdapter期待什么样的xml?
SimpleCursorAdapter mAdapter = new SimpleCursorAdapter(this,
android.R.layout.simple_list_item_1, mContacts,
new String[] { ContactsContract.Contacts.DISPLAY_NAME },
new int[] { android.R.id.text1 });
...现在“simple_list_item_1管理”是由编译器(在模拟器中运行的应用程序)所接受,但是当我 尝试运行此ListActivity,它的炸弹。
因此,在阅读其他地方关于如何完成这项任务后,我的眼睛点燃了上述“simple_list_item_1” - 那是哪里?我没有创建任何simple_list_item_1.xml文件,并且它不存在于我的\ res \ layout文件夹中。所以我(在Eclipse中)右键单击“simple_list_item_1”并选择“Open Declaration”,它调用了一个err msg,它非常类似于我在Debug Perspective中看到的关于“Class File Editor | Source nout found | JAR文件” ... \ android.jar没有源代码附件。“
所以...假设这是问题(在我的\ res \ layout文件夹中没有“simple_list_item_1.xml”),那么这个文件中的预期究竟是什么(我认为它只是一个xml定义,想要每个联系人显示在)?
==============
下面是一些logcat的数据:
以下是logcat的最后一行(好像死/挂机,一旦它到达在ListActivity(ContactsActivity):
com.aXX3AndSpace.KeepInTouch/.KeepInTouchActivity: +5s368ms
01-08 21:54:34.020: I/ActivityManager(61): Starting: Intent { cmp=com.aXX3AndSpace.KeepInTouch/.ContactsActivity } from pid 385
...这都是在一个试图进行错误的MSG的(打开应用程序,尝试调用ListActivity)注意“这应该不会发生”味精的。结束:
01-08 21:53:36.592: E/Zygote(33): setreuid() failed. errno: 2
01-08 21:53:46.423: E/Zygote(33): setreuid() failed. errno: 17
01-08 21:53:47.842: E/BatteryService(61): usbOnlinePath not found
01-08 21:53:47.842: E/BatteryService(61): batteryVoltagePath not found
01-08 21:53:47.842: E/BatteryService(61): batteryTemperaturePath not found
01-08 21:53:47.862: E/SurfaceFlinger(61): Couldn't open /sys/power/wait_for_fb_sleep or /sys/power/wait_for_fb_wake
01-08 21:53:48.082: E/SensorService(61): couldn't open device for module sensors (Invalid argument)
01-08 21:53:53.722: E/System(61): Failure starting core service
01-08 21:53:53.722: E/System(61): java.lang.SecurityException
01-08 21:53:53.722: E/System(61): at android.os.BinderProxy.transact(Native Method)
01-08 21:53:53.722: E/System(61): at android.os.ServiceManagerProxy.addService(ServiceManagerNative.java:146)
01-08 21:53:53.722: E/System(61): at android.os.ServiceManager.addService(ServiceManager.java:72)
01-08 21:53:53.722: E/System(61): at com.android.server.ServerThread.run(SystemServer.java:207)
01-08 21:53:53.742: E/EventHub(61): could not get driver version for /dev/input/mouse0, Not a typewriter
01-08 21:53:53.742: E/EventHub(61): could not get driver version for /dev/input/mice, Not a typewriter
01-08 21:53:54.032: E/SoundPool(61): error loading /system/media/audio/ui/Effect_Tick.ogg
01-08 21:53:54.032: E/SoundPool(61): error loading /system/media/audio/ui/KeypressStandard.ogg
01-08 21:53:54.032: E/SoundPool(61): error loading /system/media/audio/ui/KeypressSpacebar.ogg
01-08 21:53:54.042: E/SoundPool(61): error loading /system/media/audio/ui/KeypressDelete.ogg
01-08 21:53:54.042: E/SoundPool(61): error loading /system/media/audio/ui/KeypressReturn.ogg
01-08 21:53:54.703: E/ThrottleService(61): Could not open GPS configuration file /etc/gps.conf
01-08 21:53:57.172: E/logwrapper(158): executing /system/bin/tc failed: No such file or directory
01-08 21:53:57.242: E/logwrapper(159): executing /system/bin/tc failed: No such file or directory
01-08 21:53:57.282: E/logwrapper(160): executing /system/bin/tc failed: No such file or directory
01-08 21:54:00.074: E/jdwp(174): Failed sending reply to debugger: Broken pipe
01-08 21:54:00.712: E/Database(116): sqlite_config failed error_code = 21. THIS SHOULD NEVER occur.
错误?它是否存在?请张贴崩溃日志 – nandeesh 2012-01-08 16:20:34
如何保存崩溃日志?我看到一个“保存选定的行”选项,但一定有一种方法来一次保存它们(全选),但我没有看到它... – 2012-01-08 18:14:31
是的,我正在访问_id列: String [ ] projection = new String [] {ContactsContract.Contacts._ID, ContactsContract.Contacts.DISPLAY_NAME}; ... int selectedId = mContacts。getInt(0); // _ID列 ... ContactsContract.Data.CONTACT_ID +“=”+ selectedId,null,null); ... ContactsContract.Data.CONTACT_ID +“=”+ selectedId,null,null); ... ContactsContract.Data.CONTACT_ID +“=”+ selectedId,null,null); – 2012-01-08 18:19:42