开发者

How show "Voice Input and Output" settings page from application?

To help the user choose the settings I want from my application to open the Voice Input and Output settings page. I can just open the settings (Settings.ACTION_SETTINGS), I can open the various pages out there (Settings.ACTION_XXXX_SETTINGS) - but it can not find how to do it for Voice Input and Output page.

Any idea?

P.S. I try check source Settings.apk, but no one not using VoiceInputOut开发者_JAVA百科putSettings.java


The following is found in Android 2.3.3 source code git:

 501         <activity android:name="VoiceInputOutputSettings"
 502                 android:label="@string/voice_input_output_settings">
 503             <intent-filter>
 504                 <action android:name="android.intent.action.MAIN" />
 505                 <action android:name="com.android.settings.VOICE_INPUT_OUTPUT_SETTINGS" />
 506                 <category android:name="android.intent.category.DEFAULT" />
 507             </intent-filter>
 508         </activity>
 509 
 510         <activity android:name="TextToSpeechSettings" android:label="@string/tts_settings">
 511             <intent-filter>
 512                 <action android:name="android.intent.action.MAIN" />
 513                 <action android:name="com.android.settings.TTS_SETTINGS" />
 514                 <category android:name="android.intent.category.DEFAULT" />
 515             </intent-filter>
 516         </activity>

There may not be official constant for these two actions. But you can try "com.android.settings.VOICE_INPUT_OUTPUT_SETTINGS" and "com.android.settings.TTS_SETTINGS", it works on my Nexus S.


This is my code working with Android 2.2

final Intent intent = new Intent(Intent.ACTION_MAIN);
intent.setComponent(ComponentName.unflattenFromString("com.android.settings/.TextToSpeechSettings"));
intent.addCategory(Intent.CATEGORY_LAUNCHER );
startActivity(intent);

See also: how to show up the settings for text to speech in my app?


This code works well for showing voice input/output settings page. Hope this works for you.

Intent intent = new Intent(Intent.ACTION_MAIN);
intent.setComponent(new ComponentName("com.android.settings","com.android.settings.VoiceInputOutputSettings"));     
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜