当用户按下图片按钮时,我想打开谷歌声音搜索小部件(随谷歌应用程序推出),我想知道,有什么方法可以做到吗?请帮帮我
clue0 = []
clue1 = []
clue2 = []
clue3 = []
if guess[0] in secretNum:
clue0 = ['Pico']
if guess[0] == secretNum[0]:
clue0 = ['Fermi']
if guess[1] in secretNum or guess[1] == guess[0]:
if guess[1] == guess[0]:
if guess[1] in secretNum > 1:
clue1 == ['Pico']
else:
clue1 == []
else:
clue1 = ['Pico']
if guess[1] == secretNum[1]:
clue1 == ['Fermi']
if guess[2] in secretNum or guess[2] == guess[0] or guess[2] == guess[1]:
if guess[2] == guess[1] or guess[2] == guess[0]:
if guess[2] in secretNum > 2:
clue2 == ['Pico']
else:
clue2 == []
else:
clue2 = ['Pico']
if guess[2] == secretNum[2]:
clue2 == ['Fermi']
if guess[3] in secretNum or guess[3] == guess[0] or guess[3] == guess[1] or guess[3] == guess[2]:
if guess[3] == guess[1] or guess[3] == guess[0] or guess[3] == guess[2]:
if guess[3] in secretNum > 3:
clue3 == ['Pico']
else:
clue3 == []
else:
clue3 = ['Pico']
if guess[3] == secretNum[3]:
clue3 == ['Fermi']
clue = clue0 + clue1 + clue2 + clue3
if len(clue) == 0:
return 'Bagels'
clue.sort()
return ' '.join(clue)
答案 0 :(得分:0)
试试这个:
try {
Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
intent.putExtra(RecognizerIntent.EXTRA_PROMPT, "NOTICE TO USER");
startActivityForResult(intent, VOICE_RECOGNITION_REQUEST_CODE);
} catch (Exception e) {
e.printStackTrace();
}