Search code examples
androidbuttonspeech-recognitionspeech-to-textgoogle-text-to-speech

Style the microphone of android speech recognition input


I am developing an app for blind people. Is there a way of styling this microphone

https://i.sstatic.net/gejiA.png I need to make it screen sized.

private void promptSpeechInput() {
    Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
    intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
            RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
    intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, Locale.getDefault());
    intent.putExtra(RecognizerIntent.EXTRA_PROMPT,
            getString(R.string.speech_prompt));
    try {
        startActivityForResult(intent, REQ_CODE_SPEECH_INPUT);
    } catch (ActivityNotFoundException a) {
        Toast.makeText(getApplicationContext(),
                getString(R.string.speech_not_supported),
                Toast.LENGTH_SHORT).show();
    }
}

Thanks


Solution

  • Vins4nity, I looked for a while but couldn't find a way to style the dialog that pops up, but you could do something like what this person did.

    How can I use speech recognition without the annoying dialog in android phones

    They just as a speech recognize in their own code with their own button and skip the whole dialog. You'll have to change permissions a bit, but I think that might work for you. Let me know!