我一直在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