<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Visualizer Archives - Truiton</title>
	<atom:link href="https://www.truiton.com/tag/visualizer/feed/" rel="self" type="application/rss+xml" />
	<link></link>
	<description>Technology Reaching Us In Time - Online</description>
	<lastBuildDate>Thu, 21 Nov 2019 12:53:32 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://i0.wp.com/www.truiton.com/wp-content/uploads/2022/11/cropped-truiton_new_logo_half_white.png?fit=32%2C32&#038;ssl=1</url>
	<title>Visualizer Archives - Truiton</title>
	<link></link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">54534495</site>	<item>
		<title>Android Speech Recognition Without Dialog In A Custom Activity</title>
		<link>https://www.truiton.com/2014/06/android-speech-recognition-without-dialog-custom-activity/</link>
					<comments>https://www.truiton.com/2014/06/android-speech-recognition-without-dialog-custom-activity/#comments</comments>
		
		<dc:creator><![CDATA[Mohit Gupt]]></dc:creator>
		<pubDate>Mon, 02 Jun 2014 14:54:14 +0000</pubDate>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[RecognitionListener]]></category>
		<category><![CDATA[RecognizerIntent]]></category>
		<category><![CDATA[SpeechRecognizer]]></category>
		<category><![CDATA[Visualizer]]></category>
		<guid isPermaLink="false">http://www.truiton.com/?p=613</guid>

					<description><![CDATA[<p>A very interesting feature introduced in android is speech recognition. Many apps like Google Now, Chrome browser app, Google Maps app use speech recognition for their text input. Most of the apps use the standard easy way to get the voice inputs i.e. startActivityForResult by a RecognizerIntent. This would launch a dialog on top of&#8230;&#160;<a href="https://www.truiton.com/2014/06/android-speech-recognition-without-dialog-custom-activity/" rel="bookmark">Read More &#187;<span class="screen-reader-text">Android Speech Recognition Without Dialog In A Custom Activity</span></a></p>
<p>The post <a href="https://www.truiton.com/2014/06/android-speech-recognition-without-dialog-custom-activity/">Android Speech Recognition Without Dialog In A Custom Activity</a> appeared first on <a href="https://www.truiton.com">Truiton</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<div class="wp-block-image"><figure class="aligncenter"><img data-recalc-dims="1" fetchpriority="high" decoding="async" width="640" height="427" data-attachment-id="615" data-permalink="https://www.truiton.com/2014/06/android-speech-recognition-without-dialog-custom-activity/speechrecognizer/" data-orig-file="https://i0.wp.com/www.truiton.com/wp-content/uploads/2014/06/SpeechRecognizer.png?fit=640%2C427&amp;ssl=1" data-orig-size="640,427" data-comments-opened="1" data-image-title="SpeechRecognizer" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/www.truiton.com/wp-content/uploads/2014/06/SpeechRecognizer.png?fit=640%2C427&amp;ssl=1" src="https://i0.wp.com/www.truiton.com/wp-content/uploads/2014/06/SpeechRecognizer.png?resize=640%2C427" alt="Android Speech Recognition Without Dialog" class="wp-image-615" srcset="https://i0.wp.com/www.truiton.com/wp-content/uploads/2014/06/SpeechRecognizer.png?w=640&amp;ssl=1 640w, https://i0.wp.com/www.truiton.com/wp-content/uploads/2014/06/SpeechRecognizer.png?resize=300%2C200&amp;ssl=1 300w" sizes="(max-width: 640px) 100vw, 640px" /></figure></div>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph">A very interesting feature introduced in android is speech recognition. Many apps like Google Now, Chrome browser app, Google Maps app use speech recognition for their text input. Most of the apps use the standard easy way to get the voice inputs i.e. <code class="java plain">startActivityForResult</code> by a <a title="Android RecognizerIntent" href="http://developer.android.com/reference/android/speech/RecognizerIntent.html" target="_blank" rel="noopener noreferrer"><code class="java plain">RecognizerIntent</code></a>. This would launch a dialog on top of the app listen to voice input and would return the text back to the app. Now in this tutorial <a title="Android Speech Recognition Without Dialog In A Custom Activity" href="http://www.truiton.com/2014/06/android-speech-recognition-without-dialog-custom-activity/">Android Speech Recognition Without Dialog in a Custom Activity</a>, I would show how to do the speech recognition in android without this dialog box.</p>



<p class="wp-block-paragraph">Recently I was working on an app where I wanted voice to text input, but I did not wanted to show the Google&#8217;s pre made voice input dialog. Another way of doing this is by using the IME voice input, i.e the speech recognition from the keyboard. All you need to do is enable this option from the &#8220;Language &amp; Input&#8221; device settings. But in Android Speech Recognition Without Dialog is possible by one more method, that is to implement the <code class="java plain">RecognitionListener</code> and override all of its callback methods. This way, one would be able to recognize speech without going to the Google&#8217;s original speech recognition dialog.</p>



<p class="wp-block-paragraph">A drawback of Android Speech Recognition Without Dialog in a Custom Activity is that, we would also have to override the <code class="java plain">onRmsChanged</code> callback method if we need to show the voice visualization while recording. In this tutorial I have used the standard android <code class="java plain">ProgressBar</code> to show the voice levels.</p>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph">To start of with Android Speech Recognition Without Dialog tutorial lets first define the permissions in the android manifest:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="xml" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">&lt;?xml version="1.0" encoding="utf-8"?>
&lt;manifest package="com.truiton.customspeechrecognizer"
          xmlns:android="http://schemas.android.com/apk/res/android">

    &lt;uses-permission android:name="android.permission.INTERNET"/>
    &lt;uses-permission android:name="android.permission.RECORD_AUDIO"/>

    &lt;application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        &lt;activity android:name=".VoiceRecognitionActivity">
            &lt;intent-filter>
                &lt;action android:name="android.intent.action.MAIN"/>

                &lt;category android:name="android.intent.category.LAUNCHER"/>
            &lt;/intent-filter>
        &lt;/activity>
    &lt;/application>

&lt;/manifest></pre>



<p class="wp-block-paragraph">To use the SpeechRecognizer class which provides the access to speech recognition service we need to declare the <code>android.permission.RECORD_AUDIO</code> permission. Next lets have a look at the layout xml file <em>activity_main.xml</em>.</p>



<pre class="EnlighterJSRAW" data-enlighter-language="xml" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">&lt;?xml version="1.0" encoding="utf-8"?>
&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    &lt;ImageView
        android:id="@+id/imageView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        android:src="@drawable/truiton" />

    &lt;ProgressBar
        android:id="@+id/progressBar1"
        style="?android:attr/progressBarStyleHorizontal"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_below="@+id/toggleButton1"
        android:layout_marginTop="28dp"
        android:paddingLeft="10dp"
        android:paddingRight="10dp" />

    &lt;TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/progressBar1"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="47dp" />

    &lt;ToggleButton
        android:id="@+id/toggleButton1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="26dp"
        android:text="ToggleButton" />

&lt;/RelativeLayout></pre>



<p class="wp-block-paragraph">The key elements in this layout file are a ToggleButton, ProgressBar, and a TextView. In this layout the TextView would be used to display the results, ToggleButton would be used to start and stop the SpeechRecognizer API. Lastly the ProgressBar would be used to display the speech RMS fluctuations. In the end your layout would look something like this one below.</p>



<div class="wp-block-image"><figure class="aligncenter"><img data-recalc-dims="1" decoding="async" width="384" height="640" data-attachment-id="617" data-permalink="https://www.truiton.com/2014/06/android-speech-recognition-without-dialog-custom-activity/speechrecognizer3/" data-orig-file="https://i0.wp.com/www.truiton.com/wp-content/uploads/2014/06/SpeechRecognizer3.png?fit=384%2C640&amp;ssl=1" data-orig-size="384,640" data-comments-opened="1" data-image-title="SpeechRecognizer3" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/www.truiton.com/wp-content/uploads/2014/06/SpeechRecognizer3.png?fit=384%2C640&amp;ssl=1" src="https://i0.wp.com/www.truiton.com/wp-content/uploads/2014/06/SpeechRecognizer3.png?resize=384%2C640" alt="Android Speech Recognition Without Dialog" class="wp-image-617" srcset="https://i0.wp.com/www.truiton.com/wp-content/uploads/2014/06/SpeechRecognizer3.png?w=384&amp;ssl=1 384w, https://i0.wp.com/www.truiton.com/wp-content/uploads/2014/06/SpeechRecognizer3.png?resize=180%2C300&amp;ssl=1 180w" sizes="(max-width: 384px) 100vw, 384px" /></figure></div>



<p class="wp-block-paragraph">Lets move on to some real code now, but before that let me give you a little overview of <code class="java plain">RecognitionListener, RecognizerIntent</code>, and <code class="java plain">SpeechRecognizer</code> in android. Also how they work together in <a title="Android Speech Recognition Without Dialog In A Custom Activity" href="http://www.truiton.com/2014/06/android-speech-recognition-without-dialog-custom-activity/">Android Speech Recognition Without Dialog in a Custom Activity</a> tutorial. In Android there are two ways of speech recognition:</p>



<p class="wp-block-paragraph">1. Start an activity for result, with an Intent that has some parameters:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="java" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, "en-US");
startActivityForResult(intent, RESULT_SPEECH);</pre>



<p class="wp-block-paragraph">This would launch a dialog on top of your activity and would start capturing voice. When its done it returns the text back to your activity.</p>



<p class="wp-block-paragraph">2. The second way is the one where we implement the <code class="java plain">RecognitionListener</code> and implement all of its call back methods. This Android Speech Recognition Without Dialog tutorial focuses mainly on this second part. Another interesting feature about speech recognition is that since jellybean OS has bean released you can also do an offline voice recognition, all you need to do is download a language pack from settings.</p>



<p class="wp-block-paragraph"></p>



<h2 class="wp-block-heading">Offline Speech Recognition In Android</h2>



<ol class="wp-block-list"><li>Goto &#8220;Language &amp; input&#8221; in settings</li><li>Tap on &#8220;Voice Search&#8221;</li><li>Tap on &#8220;Offline speech recognition&#8221;</li><li>Select and download the desired package</li></ol>



<p class="wp-block-paragraph">Now lets have a look at the main class <strong>VoiceRecognitionActivity.java</strong>:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="java" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">package com.truiton.customspeechrecognizer;

import android.Manifest;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.speech.RecognitionListener;
import android.speech.RecognizerIntent;
import android.speech.SpeechRecognizer;
import android.support.annotation.NonNull;
import android.support.v4.app.ActivityCompat;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.CompoundButton;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.ToggleButton;

import java.util.ArrayList;

public class VoiceRecognitionActivity extends AppCompatActivity implements
        RecognitionListener {

    private static final int REQUEST_RECORD_PERMISSION = 100;
    private TextView returnedText;
    private ToggleButton toggleButton;
    private ProgressBar progressBar;
    private SpeechRecognizer speech = null;
    private Intent recognizerIntent;
    private String LOG_TAG = "VoiceRecognitionActivity";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        returnedText = (TextView) findViewById(R.id.textView1);
        progressBar = (ProgressBar) findViewById(R.id.progressBar1);
        toggleButton = (ToggleButton) findViewById(R.id.toggleButton1);


        progressBar.setVisibility(View.INVISIBLE);
        speech = SpeechRecognizer.createSpeechRecognizer(this);
        Log.i(LOG_TAG, "isRecognitionAvailable: " + SpeechRecognizer.isRecognitionAvailable(this));
        speech.setRecognitionListener(this);
        recognizerIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
        recognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE,
                "en");
        recognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
                RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
        recognizerIntent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS, 3);

        toggleButton.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

            @Override
            public void onCheckedChanged(CompoundButton buttonView,
                                         boolean isChecked) {
                if (isChecked) {
                    progressBar.setVisibility(View.VISIBLE);
                    progressBar.setIndeterminate(true);
                    ActivityCompat.requestPermissions
                            (VoiceRecognitionActivity.this,
                                    new String[]{Manifest.permission.RECORD_AUDIO},
                                    REQUEST_RECORD_PERMISSION);
                } else {
                    progressBar.setIndeterminate(false);
                    progressBar.setVisibility(View.INVISIBLE);
                    speech.stopListening();
                }
            }
        });

    }

    @Override
    public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
        super.onRequestPermissionsResult(requestCode, permissions, grantResults);
        switch (requestCode) {
            case REQUEST_RECORD_PERMISSION:
                if (grantResults.length > 0 &amp;&amp; grantResults[0] == PackageManager.PERMISSION_GRANTED) {
                    speech.startListening(recognizerIntent);
                } else {
                    Toast.makeText(VoiceRecognitionActivity.this, "Permission Denied!", Toast
                            .LENGTH_SHORT).show();
                }
        }
    }

    @Override
    public void onResume() {
        super.onResume();
    }

    @Override
    protected void onPause() {
        super.onPause();

    }

    @Override
    protected void onStop() {
        super.onStop();
        if (speech != null) {
            speech.destroy();
            Log.i(LOG_TAG, "destroy");
        }
    }


    @Override
    public void onBeginningOfSpeech() {
        Log.i(LOG_TAG, "onBeginningOfSpeech");
        progressBar.setIndeterminate(false);
        progressBar.setMax(10);
    }

    @Override
    public void onBufferReceived(byte[] buffer) {
        Log.i(LOG_TAG, "onBufferReceived: " + buffer);
    }

    @Override
    public void onEndOfSpeech() {
        Log.i(LOG_TAG, "onEndOfSpeech");
        progressBar.setIndeterminate(true);
        toggleButton.setChecked(false);
    }

    @Override
    public void onError(int errorCode) {
        String errorMessage = getErrorText(errorCode);
        Log.d(LOG_TAG, "FAILED " + errorMessage);
        returnedText.setText(errorMessage);
        toggleButton.setChecked(false);
    }

    @Override
    public void onEvent(int arg0, Bundle arg1) {
        Log.i(LOG_TAG, "onEvent");
    }

    @Override
    public void onPartialResults(Bundle arg0) {
        Log.i(LOG_TAG, "onPartialResults");
    }

    @Override
    public void onReadyForSpeech(Bundle arg0) {
        Log.i(LOG_TAG, "onReadyForSpeech");
    }

    @Override
    public void onResults(Bundle results) {
        Log.i(LOG_TAG, "onResults");
        ArrayList&lt;String> matches = results
                .getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION);
        String text = "";
        for (String result : matches)
            text += result + "\n";

        returnedText.setText(text);
    }

    @Override
    public void onRmsChanged(float rmsdB) {
        Log.i(LOG_TAG, "onRmsChanged: " + rmsdB);
        progressBar.setProgress((int) rmsdB);
    }

    public static String getErrorText(int errorCode) {
        String message;
        switch (errorCode) {
            case SpeechRecognizer.ERROR_AUDIO:
                message = "Audio recording error";
                break;
            case SpeechRecognizer.ERROR_CLIENT:
                message = "Client side error";
                break;
            case SpeechRecognizer.ERROR_INSUFFICIENT_PERMISSIONS:
                message = "Insufficient permissions";
                break;
            case SpeechRecognizer.ERROR_NETWORK:
                message = "Network error";
                break;
            case SpeechRecognizer.ERROR_NETWORK_TIMEOUT:
                message = "Network timeout";
                break;
            case SpeechRecognizer.ERROR_NO_MATCH:
                message = "No match";
                break;
            case SpeechRecognizer.ERROR_RECOGNIZER_BUSY:
                message = "RecognitionService busy";
                break;
            case SpeechRecognizer.ERROR_SERVER:
                message = "error from server";
                break;
            case SpeechRecognizer.ERROR_SPEECH_TIMEOUT:
                message = "No speech input";
                break;
            default:
                message = "Didn't understand, please try again.";
                break;
        }
        return message;
    }
}
</pre>



<p class="wp-block-paragraph">The main purpose of implementing this Android <code class="java plain">RecognitionListener</code> interface is to do the speech recognition without displaying the Android/Google&#8217;s speech recognition dialog. lets start with <code class="java plain">onCreate</code> method, here <code class="java plain">SpeechRecognizer.createSpeechRecognizer(this);</code> is used to initialize the SpeechRecognizer object. This Android SpeechRecognizer class is the one through which one can access the speech recognition service. This object is the main object in this implementation through which we start and stop the voice recognition process.</p>



<p class="wp-block-paragraph">Another important thing which I skipped in the beginning was the display of speech visualization. Generally when working with default Google&#8217;s Voice Search dialog, while the voice is being captured a visualization is displayed around the mic button. But now that we are implementing our own activity where voice will be captured, we also need to implement a voice visualization. This is done through the&nbsp;<code class="java plain">onRmsChanged(float rmsdB)</code> method. An interesting observation about this method is that rmsdB is always between the range of -2.~ to 10.0, this is not stated anywhere in the official documentation, its just my personal observation. Also when I searched the net found someone <a title="Stack Overflow" href="http://stackoverflow.com/questions/21208769/what-is-the-max-value-for-onrmschanged-in-recognitionlistener#comment32154154_21215119" target="_blank" rel="noopener noreferrer">here </a>saying this. Therefore in the onBeginningOfSpeech() method I have set the max value of progress bar to 10. In the standard flow of&nbsp;<code class="java plain">RecognitionListener</code> whenever voice fluctuations are observed the rmsdB is changed, and onRmsChanged method is called. In this implementation I use this method to update the progress bar. I would like to state that I have used this progress bar in this&nbsp;Android Speech Recognition Without Dialog in a Custom Activity tutorial for the sake of simplicity, one can use any sort of complex graphs to show a visualization.</p>



<p class="wp-block-paragraph">Next when the toggle button is changed <code>SpeechRecognizer.startListening(recognizerIntent);</code> and <code>SpeechRecognizer.stopListening();</code> methods are called accordingly, with an appropriate <a title="Android RecognizerIntent" rel="noopener noreferrer" href="http://developer.android.com/reference/android/speech/RecognizerIntent.html" target="_blank">RecognizerIntent</a>. After this implementation your app would look something like this:</p>



<ul data-carousel-extra='{&quot;blog_id&quot;:1,&quot;permalink&quot;:&quot;https://www.truiton.com/2014/06/android-speech-recognition-without-dialog-custom-activity/&quot;}'  class="wp-block-gallery columns-3 is-cropped wp-block-gallery-1 is-layout-flex wp-block-gallery-is-layout-flex"><li class="blocks-gallery-item"><figure><img data-recalc-dims="1" decoding="async" width="384" height="640" data-attachment-id="616" data-permalink="https://www.truiton.com/2014/06/android-speech-recognition-without-dialog-custom-activity/speechrecognizer2/" data-orig-file="https://i0.wp.com/www.truiton.com/wp-content/uploads/2014/06/SpeechRecognizer2.png?fit=384%2C640&amp;ssl=1" data-orig-size="384,640" data-comments-opened="1" data-image-title="SpeechRecognizer2" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/www.truiton.com/wp-content/uploads/2014/06/SpeechRecognizer2.png?fit=384%2C640&amp;ssl=1" src="https://i0.wp.com/www.truiton.com/wp-content/uploads/2014/06/SpeechRecognizer2.png?resize=384%2C640&#038;ssl=1" alt="Android Speech Recognition Without Dialog" data-id="616" class="wp-image-616" srcset="https://i0.wp.com/www.truiton.com/wp-content/uploads/2014/06/SpeechRecognizer2.png?w=384&amp;ssl=1 384w, https://i0.wp.com/www.truiton.com/wp-content/uploads/2014/06/SpeechRecognizer2.png?resize=180%2C300&amp;ssl=1 180w" sizes="(max-width: 384px) 100vw, 384px" /></figure></li><li class="blocks-gallery-item"><figure><img data-recalc-dims="1" loading="lazy" decoding="async" width="384" height="640" data-attachment-id="617" data-permalink="https://www.truiton.com/2014/06/android-speech-recognition-without-dialog-custom-activity/speechrecognizer3/" data-orig-file="https://i0.wp.com/www.truiton.com/wp-content/uploads/2014/06/SpeechRecognizer3.png?fit=384%2C640&amp;ssl=1" data-orig-size="384,640" data-comments-opened="1" data-image-title="SpeechRecognizer3" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/www.truiton.com/wp-content/uploads/2014/06/SpeechRecognizer3.png?fit=384%2C640&amp;ssl=1" src="https://i0.wp.com/www.truiton.com/wp-content/uploads/2014/06/SpeechRecognizer3.png?resize=384%2C640&#038;ssl=1" alt="Android Speech Recognition Without Dialog" data-id="617" class="wp-image-617" srcset="https://i0.wp.com/www.truiton.com/wp-content/uploads/2014/06/SpeechRecognizer3.png?w=384&amp;ssl=1 384w, https://i0.wp.com/www.truiton.com/wp-content/uploads/2014/06/SpeechRecognizer3.png?resize=180%2C300&amp;ssl=1 180w" sizes="auto, (max-width: 384px) 100vw, 384px" /></figure></li><li class="blocks-gallery-item"><figure><img data-recalc-dims="1" loading="lazy" decoding="async" width="384" height="640" data-attachment-id="618" data-permalink="https://www.truiton.com/2014/06/android-speech-recognition-without-dialog-custom-activity/speechrecognizer4/" data-orig-file="https://i0.wp.com/www.truiton.com/wp-content/uploads/2014/06/SpeechRecognizer4.png?fit=384%2C640&amp;ssl=1" data-orig-size="384,640" data-comments-opened="1" data-image-title="SpeechRecognizer4" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/www.truiton.com/wp-content/uploads/2014/06/SpeechRecognizer4.png?fit=384%2C640&amp;ssl=1" src="https://i0.wp.com/www.truiton.com/wp-content/uploads/2014/06/SpeechRecognizer4.png?resize=384%2C640&#038;ssl=1" alt="Android Speech Recognition Without Dialog" data-id="618" class="wp-image-618" srcset="https://i0.wp.com/www.truiton.com/wp-content/uploads/2014/06/SpeechRecognizer4.png?w=384&amp;ssl=1 384w, https://i0.wp.com/www.truiton.com/wp-content/uploads/2014/06/SpeechRecognizer4.png?resize=180%2C300&amp;ssl=1 180w" sizes="auto, (max-width: 384px) 100vw, 384px" /></figure></li></ul>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph">To see the fully working code sample for this Android voice to text conversion, please visit the link below:</p>



<p class="wp-block-paragraph" style="text-align:center"><a class="fasc-button fasc-size-large fasc-type-flat fasc-rounded-medium ico-fa fasc-ico-before fa-github" style="background-color: #0364af; color: #ffffff;" target="_blank" rel="noopener noreferrer" href="https://github.com/Truiton/CustomSpeechRecognizer">Code Sample</a></p>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph">Coming to an end, one of the most important methods to build the Android speech Recognition App Without Pop Up, is <code>onResults(Bundle results)</code> method. Here in this method speech recognition result is passed as an argument in the form of an ArrayList. After this one can process the result, as required. In my case I just displayed it in a TextView. Hope this <a title="Android Speech Recognition Without Dialog In A Custom Activity" href="http://www.truiton.com/2014/06/android-speech-recognition-without-dialog-custom-activity/">Android Speech Recognition Without Dialog in a Custom Activity</a> tutorial helped you, if it did, please share this with your friends on Google+, Facebook, and don&#8217;t forget to like our Facebook page for updates.</p>
<div class="saboxplugin-wrap" itemtype="http://schema.org/Person" itemscope itemprop="author"><div class="saboxplugin-tab"><div class="saboxplugin-gravatar"><img alt='Mohit Gupt' src='https://secure.gravatar.com/avatar/a816092ad56645d2635ccfceb9f7e9d44821c19dec126cb394c882ba574eaa04?s=100&#038;d=mm&#038;r=g' srcset='https://secure.gravatar.com/avatar/a816092ad56645d2635ccfceb9f7e9d44821c19dec126cb394c882ba574eaa04?s=200&#038;d=mm&#038;r=g 2x' class='avatar avatar-100 photo' height='100' width='100' itemprop="image"/></div><div class="saboxplugin-authorname"><a href="https://www.truiton.com/author/mohitgupt/" class="vcard author" rel="author"><span class="fn">Mohit Gupt</span></a></div><div class="saboxplugin-desc"><div itemprop="description"><p>Born in New Delhi, India. A software engineer by profession, an android enthusiast and mobile development evangelist. My motive here is to create a group of skilled engineers, who can build better software. Reason being programming is my passion, and also it feels good to make a device do something you want. Professionally I have worked with many software engineering and product development firms. As of now too, I am employed as a senior engineer in a leading tech company. In total I may have worked on more than 20 projects professionally, but whenever I get spare time I share my thoughts here at Truiton.</p>
</div></div><div class="saboxplugin-web "><a href="http://www.truiton.com" target="_self" >www.truiton.com</a></div><div class="clearfix"></div><div class="saboxplugin-socials "><a title="Wordpress" target="_blank" href="https://www.truiton.com/author/mohitgupt/" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-wordpress" role="img" xmlns="http://www.w3.org/2000/svg" viewbox="0 0 512 512"><path fill="currentColor" d="M61.7 169.4l101.5 278C92.2 413 43.3 340.2 43.3 256c0-30.9 6.6-60.1 18.4-86.6zm337.9 75.9c0-26.3-9.4-44.5-17.5-58.7-10.8-17.5-20.9-32.4-20.9-49.9 0-19.6 14.8-37.8 35.7-37.8.9 0 1.8.1 2.8.2-37.9-34.7-88.3-55.9-143.7-55.9-74.3 0-139.7 38.1-177.8 95.9 5 .2 9.7.3 13.7.3 22.2 0 56.7-2.7 56.7-2.7 11.5-.7 12.8 16.2 1.4 17.5 0 0-11.5 1.3-24.3 2l77.5 230.4L249.8 247l-33.1-90.8c-11.5-.7-22.3-2-22.3-2-11.5-.7-10.1-18.2 1.3-17.5 0 0 35.1 2.7 56 2.7 22.2 0 56.7-2.7 56.7-2.7 11.5-.7 12.8 16.2 1.4 17.5 0 0-11.5 1.3-24.3 2l76.9 228.7 21.2-70.9c9-29.4 16-50.5 16-68.7zm-139.9 29.3l-63.8 185.5c19.1 5.6 39.2 8.7 60.1 8.7 24.8 0 48.5-4.3 70.6-12.1-.6-.9-1.1-1.9-1.5-2.9l-65.4-179.2zm183-120.7c.9 6.8 1.4 14 1.4 21.9 0 21.6-4 45.8-16.2 76.2l-65 187.9C426.2 403 468.7 334.5 468.7 256c0-37-9.4-71.8-26-102.1zM504 256c0 136.8-111.3 248-248 248C119.2 504 8 392.7 8 256 8 119.2 119.2 8 256 8c136.7 0 248 111.2 248 248zm-11.4 0c0-130.5-106.2-236.6-236.6-236.6C125.5 19.4 19.4 125.5 19.4 256S125.6 492.6 256 492.6c130.5 0 236.6-106.1 236.6-236.6z"></path></svg></span></a><a title="Twitter" target="_blank" href="http://twitter.com/mohitgupt" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-twitter" role="img" xmlns="http://www.w3.org/2000/svg" viewbox="0 0 30 30"><path d="M26.37,26l-8.795-12.822l0.015,0.012L25.52,4h-2.65l-6.46,7.48L11.28,4H4.33l8.211,11.971L12.54,15.97L3.88,26h2.65 l7.182-8.322L19.42,26H26.37z M10.23,6l12.34,18h-2.1L8.12,6H10.23z" /></svg></span></a><a title="Facebook" target="_blank" href="https://www.facebook.com/Mr.Mohit.Gupt" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-facebook" role="img" xmlns="http://www.w3.org/2000/svg" viewbox="0 0 264 512"><path fill="currentColor" d="M76.7 512V283H0v-91h76.7v-71.7C76.7 42.4 124.3 0 193.8 0c33.3 0 61.9 2.5 70.2 3.6V85h-48.2c-37.8 0-45.1 18-45.1 44.3V192H256l-11.7 91h-73.6v229"></path></svg></span></a></div></div></div><p>The post <a href="https://www.truiton.com/2014/06/android-speech-recognition-without-dialog-custom-activity/">Android Speech Recognition Without Dialog In A Custom Activity</a> appeared first on <a href="https://www.truiton.com">Truiton</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.truiton.com/2014/06/android-speech-recognition-without-dialog-custom-activity/feed/</wfw:commentRss>
			<slash:comments>43</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">613</post-id>	</item>
	</channel>
</rss>

<!--
Performance optimized by W3 Total Cache. Learn more: https://www.boldgrid.com/w3-total-cache/?utm_source=w3tc&utm_medium=footer_comment&utm_campaign=free_plugin

Page Caching using Disk: Enhanced 
Minified using Disk

Served from: www.truiton.com @ 2026-07-03 23:30:42 by W3 Total Cache
-->