0
我的應用程序有一個按鈕,用於將用戶發送到區域設置。 我這樣做是與此代碼:android.settings.INPUT_METHOD_SETTINGS不適用於HTC英雄
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);
上面的代碼將工作在每個設備上:)
好主意我修好了! Plz將此添加到您的答案,我會給它正確的: \t \t \t \t Intent intent = new Intent(); \t \t \t \t intent.setAction(Intent.ACTION_MAIN); \t \t \t \t ComponentName com = new ComponentName(「com.android.settings」,「com.android.settings.LanguageSettings」); \t \t \t \t intent.setComponent(com); \t \t \t \t startActivity(intent); – Macarse 2010-02-03 19:14:04