Skip to content Skip to sidebar Skip to footer

Google Recognizer And Pocketsphinx In Two Different Classes, How To Loop Them?

Yesterday i ask a simplified question of my problem, but think its too simplified. What my programm should do, is to hear a keyword and when he hear it, he should listen to what i

Solution 1:

You can store reference to the main activity in Jarvis object in a field:

classJarvis {
    ....
    private MainActivity m;
    ....
    publicJarvis(MainActivity m){
         this.m = m;
    }
    ....
    publicvoidonResults(Bundle results){
       ....
       m.next();
    }

You can also send intents to the main activity as described here. This might be overkill in your case though.

Post a Comment for "Google Recognizer And Pocketsphinx In Two Different Classes, How To Loop Them?"