我正在尝试谷歌地图.我发现了这个说法.
google.maps.event.addDomListener(window, 'load', initialize);
Run Code Online (Sandbox Code Playgroud)
该陈述的功能是什么?
我开发的 Android 应用程序可以识别普通话语音,然后生成文本。但我找不到如何做到这一点。有人能给我其他语言(普通话、法语等)语音识别的示例代码吗?
public class MainActivity extends Activity {
private TextView txtSpeechInput;
private ImageButton btnSpeak;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
txtSpeechInput = (TextView) findViewById(R.id.txtSpeechInput);
btnSpeak = (ImageButton) findViewById(R.id.btnSpeak);
// hide the action bar
getActionBar().hide();
btnSpeak.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
listen();
}
});
}
private static int SR_CODE = 123;
/**
* Initializes the speech recognizer and starts listening to the user input
*/
private void listen() {
Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
//Specify …Run Code Online (Sandbox Code Playgroud)