访问 Galaxy S 上的电话簿会使应用程序崩溃

发布于 2024-09-15 18:14:23 字数 4980 浏览 5 评论 0原文

有谁知道如何从 Galaxy S 访问联系人?

我有这行代码:

Intent intent = new Intent(Intent.ACTION_VIEW, Contacts.CONTENT_URI);
startActivity(intent);

它适用于模拟器以及三星 i5700。我尝试在 Samsung i9000 (Galaxy S) 上运行我的应用程序,但它崩溃了。

我从 LogCat 收到以下错误:

08-23 11:28:19.511: INFO/ActivityManager(2234): Starting activity: Intent { act=android.intent.action.VIEW dat=content://com.android.contacts/contacts }
08-23 11:28:19.516: DEBUG/AndroidRuntime(5067): Shutting down VM
08-23 11:28:19.516: WARN/dalvikvm(5067): threadid=3: thread exiting with uncaught exception (group=0x4001dc20)
08-23 11:28:19.516: ERROR/AndroidRuntime(5067): Uncaught handler: thread main exiting due to uncaught exception
08-23 11:28:19.526: INFO/Lights(2234): set_light_backlight[0~255]:(42) gamma_value:(4) BRIGHTNESS_MODE(1)
08-23 11:28:19.526: VERBOSE/AudioHardwareALSA(2183): ------------------------>>>>>> ALSA OPEN mode 0,device 2 
08-23 11:28:19.526: ERROR/AndroidRuntime(5067): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=content://com.android.contacts/contacts }
08-23 11:28:19.526: ERROR/AndroidRuntime(5067):     at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1408)
08-23 11:28:19.526: ERROR/AndroidRuntime(5067):     at android.app.Instrumentation.execStartActivity(Instrumentation.java:1378)
08-23 11:28:19.526: ERROR/AndroidRuntime(5067):     at android.app.Activity.startActivityForResult(Activity.java:2758)
08-23 11:28:19.526: ERROR/AndroidRuntime(5067):     at android.app.Activity.startActivity(Activity.java:2864)
08-23 11:28:19.526: ERROR/AndroidRuntime(5067):     at au.com.orionmedia.vidcall.KeypadActivity.onClick(KeypadActivity.java:313)
08-23 11:28:19.526: ERROR/AndroidRuntime(5067):     at android.view.View.performClick(View.java:2417)
08-23 11:28:19.526: ERROR/AndroidRuntime(5067):     at android.view.View.onTouchEvent(View.java:4232)
08-23 11:28:19.526: ERROR/AndroidRuntime(5067):     at android.view.View.dispatchTouchEvent(View.java:3762)
08-23 11:28:19.526: ERROR/AndroidRuntime(5067):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
08-23 11:28:19.526: ERROR/AndroidRuntime(5067):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
08-23 11:28:19.526: ERROR/AndroidRuntime(5067):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
08-23 11:28:19.526: ERROR/AndroidRuntime(5067):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
08-23 11:28:19.526: ERROR/AndroidRuntime(5067):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
08-23 11:28:19.526: ERROR/AndroidRuntime(5067):     at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1713)
08-23 11:28:19.526: ERROR/AndroidRuntime(5067):     at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1131)
08-23 11:28:19.526: ERROR/AndroidRuntime(5067):     at android.app.Activity.dispatchTouchEvent(Activity.java:2070)
08-23 11:28:19.526: ERROR/AndroidRuntime(5067):     at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1697)
08-23 11:28:19.526: ERROR/AndroidRuntime(5067):     at android.view.ViewRoot.handleMessage(ViewRoot.java:1691)
08-23 11:28:19.526: ERROR/AndroidRuntime(5067):     at android.os.Handler.dispatchMessage(Handler.java:99)
08-23 11:28:19.526: ERROR/AndroidRuntime(5067):     at android.os.Looper.loop(Looper.java:123)
08-23 11:28:19.526: ERROR/AndroidRuntime(5067):     at android.app.ActivityThread.main(ActivityThread.java:4363)
08-23 11:28:19.526: ERROR/AndroidRuntime(5067):     at java.lang.reflect.Method.invokeNative(Native Method)
08-23 11:28:19.526: ERROR/AndroidRuntime(5067):     at java.lang.reflect.Method.invoke(Method.java:521)
08-23 11:28:19.526: ERROR/AndroidRuntime(5067):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:862)
08-23 11:28:19.526: ERROR/AndroidRuntime(5067):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620)
08-23 11:28:19.526: ERROR/AndroidRuntime(5067):     at dalvik.system.NativeStart.main(Native Method)

我尝试从启动器访问电话簿,这就是我得到的结果:

08-23 17:50:53.885: INFO/ActivityManager(2244): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.android.contacts/com.sec.android.app.contacts.PhoneBookTopMenuActivity }
08-23 17:50:54.055: INFO/ContactsListActivity(2401): Called with action: com.android.contacts.action.LIST_DEFAULT
08-23 17:50:54.205: INFO/ActivityManager(2244): Displayed activity com.android.contacts/com.sec.android.app.contacts.PhoneBookTopMenuActivity: 208 ms (total 1265628 ms)

根据这些日志,我猜测手机不使用默认联系人应用程序,并且不处理意图我正在从我的应用程序中解雇。

我尝试更改传递给意图的 URI,但它也不起作用。

还有其他人看到这个问题吗?关于我下一步可以尝试什么有什么建议吗?

谢谢你! - 扎拉

Does anyone know how to access the contacts from the Galaxy S?

I have this line of code:

Intent intent = new Intent(Intent.ACTION_VIEW, Contacts.CONTENT_URI);
startActivity(intent);

and it works on the emulator as well as on the Samsung i5700. I tried running my app on Samsung i9000 (Galaxy S) but it crashes.

I am getting the following error from LogCat:

08-23 11:28:19.511: INFO/ActivityManager(2234): Starting activity: Intent { act=android.intent.action.VIEW dat=content://com.android.contacts/contacts }
08-23 11:28:19.516: DEBUG/AndroidRuntime(5067): Shutting down VM
08-23 11:28:19.516: WARN/dalvikvm(5067): threadid=3: thread exiting with uncaught exception (group=0x4001dc20)
08-23 11:28:19.516: ERROR/AndroidRuntime(5067): Uncaught handler: thread main exiting due to uncaught exception
08-23 11:28:19.526: INFO/Lights(2234): set_light_backlight[0~255]:(42) gamma_value:(4) BRIGHTNESS_MODE(1)
08-23 11:28:19.526: VERBOSE/AudioHardwareALSA(2183): ------------------------>>>>>> ALSA OPEN mode 0,device 2 
08-23 11:28:19.526: ERROR/AndroidRuntime(5067): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=content://com.android.contacts/contacts }
08-23 11:28:19.526: ERROR/AndroidRuntime(5067):     at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1408)
08-23 11:28:19.526: ERROR/AndroidRuntime(5067):     at android.app.Instrumentation.execStartActivity(Instrumentation.java:1378)
08-23 11:28:19.526: ERROR/AndroidRuntime(5067):     at android.app.Activity.startActivityForResult(Activity.java:2758)
08-23 11:28:19.526: ERROR/AndroidRuntime(5067):     at android.app.Activity.startActivity(Activity.java:2864)
08-23 11:28:19.526: ERROR/AndroidRuntime(5067):     at au.com.orionmedia.vidcall.KeypadActivity.onClick(KeypadActivity.java:313)
08-23 11:28:19.526: ERROR/AndroidRuntime(5067):     at android.view.View.performClick(View.java:2417)
08-23 11:28:19.526: ERROR/AndroidRuntime(5067):     at android.view.View.onTouchEvent(View.java:4232)
08-23 11:28:19.526: ERROR/AndroidRuntime(5067):     at android.view.View.dispatchTouchEvent(View.java:3762)
08-23 11:28:19.526: ERROR/AndroidRuntime(5067):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
08-23 11:28:19.526: ERROR/AndroidRuntime(5067):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
08-23 11:28:19.526: ERROR/AndroidRuntime(5067):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
08-23 11:28:19.526: ERROR/AndroidRuntime(5067):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
08-23 11:28:19.526: ERROR/AndroidRuntime(5067):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
08-23 11:28:19.526: ERROR/AndroidRuntime(5067):     at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1713)
08-23 11:28:19.526: ERROR/AndroidRuntime(5067):     at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1131)
08-23 11:28:19.526: ERROR/AndroidRuntime(5067):     at android.app.Activity.dispatchTouchEvent(Activity.java:2070)
08-23 11:28:19.526: ERROR/AndroidRuntime(5067):     at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1697)
08-23 11:28:19.526: ERROR/AndroidRuntime(5067):     at android.view.ViewRoot.handleMessage(ViewRoot.java:1691)
08-23 11:28:19.526: ERROR/AndroidRuntime(5067):     at android.os.Handler.dispatchMessage(Handler.java:99)
08-23 11:28:19.526: ERROR/AndroidRuntime(5067):     at android.os.Looper.loop(Looper.java:123)
08-23 11:28:19.526: ERROR/AndroidRuntime(5067):     at android.app.ActivityThread.main(ActivityThread.java:4363)
08-23 11:28:19.526: ERROR/AndroidRuntime(5067):     at java.lang.reflect.Method.invokeNative(Native Method)
08-23 11:28:19.526: ERROR/AndroidRuntime(5067):     at java.lang.reflect.Method.invoke(Method.java:521)
08-23 11:28:19.526: ERROR/AndroidRuntime(5067):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:862)
08-23 11:28:19.526: ERROR/AndroidRuntime(5067):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620)
08-23 11:28:19.526: ERROR/AndroidRuntime(5067):     at dalvik.system.NativeStart.main(Native Method)

I tried accessing the phonebook from the launcher, and this is what I get:

08-23 17:50:53.885: INFO/ActivityManager(2244): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.android.contacts/com.sec.android.app.contacts.PhoneBookTopMenuActivity }
08-23 17:50:54.055: INFO/ContactsListActivity(2401): Called with action: com.android.contacts.action.LIST_DEFAULT
08-23 17:50:54.205: INFO/ActivityManager(2244): Displayed activity com.android.contacts/com.sec.android.app.contacts.PhoneBookTopMenuActivity: 208 ms (total 1265628 ms)

Based on those logs, I am guessing that the phone does not use the default contacts application and it does not handle the intent I am firing from my app.

I tried changing the URI I am passing to the intent, but it doesn't work either.

Has anybody else seen this problem? Any suggestions on what I can try next?

Thank you!
- Zarah

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

债姬 2024-09-22 18:14:23

Try ContactsContract.Contacts.CONTACTS_URI instead. You are using the Android 1.x API, and it is possible Samsung failed to test that sufficiently. My understanding is that the Samsung Galaxy S is an Android 2.x device.

我三岁 2024-09-22 18:14:23

我们做了一个小修复,但希望三星能够更新它(我们很快就发现了异常部分)

使用 ComponentName

we did a small fix but hoping that samsung will have it updated (we did catched that for the exception part soon)

use ComponentName

你又不是我 2024-09-22 18:14:23

试试这个...它对我有用。 (GALAXY S)

Intent intent = new Intent();
intent.setAction(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
ComponentName componentName = new ComponentName("com.android.contacts", "com.sec.android.app.contacts.PhoneBookTopMenuActivity");
intent.setComponent(componentName);

然后开始您的活动...

Try this... It worked for me. (GALAXY S)

Intent intent = new Intent();
intent.setAction(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
ComponentName componentName = new ComponentName("com.android.contacts", "com.sec.android.app.contacts.PhoneBookTopMenuActivity");
intent.setComponent(componentName);

Then start your activity...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文