Android: Changing the start voice recognition of PochetSphinix
<p>Following the guide on the official website:
<a href="http://cmusphinx.sourceforge.net/2011/05/building-pocketsphinx-on-android/" rel="nofollow">http://cmusphinx.sourceforge.net/2011/05/building-pocketsphinx-on-android/</a></p>

<p>I managed to install the example on my device.</p>

<p>Now I'd like to change the following code:</p>

<pre><code>public boolean onTouch(View v, MotionEvent event) {
    switch (event.getAction()) {
    case MotionEvent.ACTION_DOWN:
        start_date = new Date();
        this.listening = true;
        this.rec.start();
        break;
    case MotionEvent.ACTION_UP:
        Date end_date = new Date();
        long nmsec = end_date.getTime() - start_date.getTime();
        this.speech_dur = (float)nmsec / 1000;
        if (this.listening) {
            Log.d(getClass().getName(), "Showing Dialog");
            this.rec_dialog = ProgressDialog.show(PocketSphinxDemo.this, "", "Recognizing speech...", true);
            this.rec_dialog.setCancelable(false);
            this.listening = false;
        }
        this.rec.stop();
        break;
    default:
        ;
    }
    /* Let the button handle its own state */
    return false;
}
</code></pre>

<p>so that you do not have to use the click on the button to start voice recognition, that recognition be started when you start talking and stop immediately after you finish speaking.</p>

<p>This is possible? I hope there is someone that I can help.</p>

<p>Thank you.</p>
