How show “Voice Input and Output” settings page from application?

非 Y 不嫁゛ 提交于 2019-12-12 09:17:41

问题


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 VoiceInputOutputSettings.java


回答1:


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.




回答2:


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?




回答3:


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);


来源:https://stackoverflow.com/questions/5702790/how-show-voice-input-and-output-settings-page-from-application

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!