android.settings.INPUT_METHOD_SETTINGS 不适用于 HTC Hero

发布于 2024-08-20 02:54:03 字数 1618 浏览 3 评论 0原文

我的应用程序有一个按钮,可将用户发送到区域设置。 我使用以下代码执行此操作:

startActivity(new Intent(android.provider.Settings.ACTION_INPUT_METHOD_SETTINGS));

这在某些设备上运行良好,但在 HTC Hero 上我得到:

02-03 13:59:27.501: INFO/ActivityManager(69): Starting activity: Intent { action=android.settings.INPUT_METHOD_SETTINGS flags=0x10000000 }
02-03 13:59:27.531: DEBUG/AndroidRuntime(1916): Shutting down VM
02-03 13:59:27.531: WARN/dalvikvm(1916): threadid=3: thread exiting with uncaught exception (group=0x40013140)
02-03 13:59:27.531: ERROR/AndroidRuntime(1916): Uncaught handler: thread main exiting due to uncaught exception
02-03 13:59:27.611: ERROR/AndroidRuntime(1916): android.content.ActivityNotFoundException: No Activity found to handle Intent { action=android.settings.INPUT_METHOD_SETTINGS flags=0x10000000 }
02-03 13:59:27.611: ERROR/AndroidRuntime(1916):     at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1529)
02-03 13:59:27.611: ERROR/AndroidRuntime(1916):     at android.app.Instrumentation.execStartActivity(Instrumentation.java:1499)
02-03 13:59:27.611: ERROR/AndroidRuntime(1916):     at android.app.Activity.startActivityForResult(Activity.java:2669)
02-03 13:59:27.611: ERROR/AndroidRuntime(1916):     at android.app.Activity.startActivity(Activity.java:2713)

编辑: 解决方案!

Intent intent = new Intent();
intent.setAction(Intent.ACTION_MAIN);
ComponentName com = new ComponentName("com.android.settings", "com.android.settings.LanguageSettings");
intent.setComponent(com); startActivity(intent);

前面的代码适用于所有设备:)

My application has a button that sends the user to the locale setting.
I do this with this code:

startActivity(new Intent(android.provider.Settings.ACTION_INPUT_METHOD_SETTINGS));

This works fine with some devices, but with the HTC Hero I get:

02-03 13:59:27.501: INFO/ActivityManager(69): Starting activity: Intent { action=android.settings.INPUT_METHOD_SETTINGS flags=0x10000000 }
02-03 13:59:27.531: DEBUG/AndroidRuntime(1916): Shutting down VM
02-03 13:59:27.531: WARN/dalvikvm(1916): threadid=3: thread exiting with uncaught exception (group=0x40013140)
02-03 13:59:27.531: ERROR/AndroidRuntime(1916): Uncaught handler: thread main exiting due to uncaught exception
02-03 13:59:27.611: ERROR/AndroidRuntime(1916): android.content.ActivityNotFoundException: No Activity found to handle Intent { action=android.settings.INPUT_METHOD_SETTINGS flags=0x10000000 }
02-03 13:59:27.611: ERROR/AndroidRuntime(1916):     at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1529)
02-03 13:59:27.611: ERROR/AndroidRuntime(1916):     at android.app.Instrumentation.execStartActivity(Instrumentation.java:1499)
02-03 13:59:27.611: ERROR/AndroidRuntime(1916):     at android.app.Activity.startActivityForResult(Activity.java:2669)
02-03 13:59:27.611: ERROR/AndroidRuntime(1916):     at android.app.Activity.startActivity(Activity.java:2713)

EDIT:
SOLUTION!

Intent intent = new Intent();
intent.setAction(Intent.ACTION_MAIN);
ComponentName com = new ComponentName("com.android.settings", "com.android.settings.LanguageSettings");
intent.setComponent(com); startActivity(intent);

The previous code will work on every device :)

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

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

发布评论

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

评论(1

花伊自在美 2024-08-27 02:54:03

官方的说法是,你可能无法修复它。 HTC 显然用您正在运行的特定 Hero 固件破坏了 SDK。您可以使用android.os.Build来识别您正在使用Hero并禁用导致startActivity()调用失败的任何选项(例如,禁用尝试打开这些设置)。

非官方地,尝试通过“设置”应用程序手动进入该屏幕,并查看 LogCat 输出。您可以通过这种方式确定一个可以触发您所寻找的特定屏幕(如果存在)的 Intent。

Officially, you probably cannot fix it. HTC apparently broke the SDK with the particular Hero firmware you are running. You can use android.os.Build to identify that you are on a Hero and disable whatever option leads to the failing startActivity() call (e.g., disable the menu choice that tries to open up these settings).

Unofficially, try going to that screen manually via the Settings application, and take a look at the LogCat output. You might be able to determine that way an Intent that can trigger the specific screen you seek, if one exists.

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