app/src/main/java/edu/cmu/pocketsphinx/demo/PocketSphinxActivity.java
@Override
    public void onResult(Hypothesis hypothesis) {
        if (mTCPClient != null) {
            ((TextView) findViewById(R.id.result_text)).setText("");

            String msg;

            if (NAME != null && COMMAND != null && DUR != null)
                msg = NAME.concat(COMMAND).concat(DUR);
            else
                msg = null;

            if (msg != null) {
                makeText(getApplicationContext(), msg, Toast.LENGTH_SHORT).show();
                Log.d("VOICE", "\"" + msg + "\" \"" + KEYPHRASE + "\"");
                mTCPClient.sendMessage(msg);
                NAME = null;
                COMMAND = null;
                DUR = null;
            }
        }
    }
/**
     * This callback is called when we stop the recognizer.
     */
This callback is called when we stop the recognizer.
This callback is called when we stop the recognizer .
@Override
    public void onResult(Hypothesis hypothesis) {
        if (mTCPClient != null) {
            ((TextView) findViewById(R.id.result_text)).setText("");
            String msg;
            if (NAME != null && COMMAND != null && DUR != null)
                msg = NAME.concat(COMMAND).concat(DUR);
            else
                msg = null;
            if (msg != null) {
                makeText(getApplicationContext(), msg, Toast.LENGTH_SHORT).show();
                Log.d("VOICE", "\"" + msg + "\" \"" + KEYPHRASE + "\"");
                mTCPClient.sendMessage(msg);
                NAME = null;
                COMMAND = null;
                DUR = null;
            }
        }
    }
@ Override public void onResult ( Hypothesis hypothesis ) { if ( mTCPClient != null ) { ( ( TextView ) findViewById ( R . id . result_text ) ) . setText ( "" ) ; String msg ; if ( NAME != null && COMMAND != null && DUR != null ) msg = NAME . concat ( COMMAND ) . concat ( DUR ) ; else msg = null ; if ( msg != null ) { makeText ( getApplicationContext ( ) , msg , Toast . LENGTH_SHORT ) . show ( ) ; Log . d ( "VOICE" , "\"" + msg + "\" \"" + KEYPHRASE + "\"" ) ; mTCPClient . sendMessage ( msg ) ; NAME = null ; COMMAND = null ; DUR = null ; } } }
This callback is called when we stop the recognizer.
This callback is called when we stop the recognizer .