Added generic code in MainActivity for robot

This commit is contained in:
Luca Warmenhoven
2024-04-19 15:40:18 +02:00
parent c9a35f5e2a
commit 56875ce2d8
3 changed files with 39 additions and 23 deletions

View File

@@ -4,15 +4,34 @@ import android.app.Activity;
import android.media.MediaRecorder;
import android.os.Bundle;
public class MainActivity extends Activity {
public class MainActivity extends RobotActivity implements RobotLifecycleCallbacks {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
/* Since this is our main activity, we can start our audio recording service here */
// Register the RobotLifecycleCallbacks to this Activity.
QiSDK.register(this, this);
}
}
@Override
protected void onDestroy() {
// Unregister the RobotLifecycleCallbacks for this Activity.
QiSDK.unregister(this, this);
super.onDestroy();
}
@Override
public void onRobotFocusGained(QiContext qiContext) {
// The robot focus is gained.
}
@Override
public void onRobotFocusLost() {
// The robot focus is lost.
}
@Override
public void onRobotFocusRefused(String reason) {
// The robot focus is refused.
}
}

View File

@@ -29,11 +29,11 @@ public class SpeechGenerator {
}
/**
* Default constructor, sets the language to English
* Default constructor, sets the language to Dutch
*/
public SpeechGenerator()
{
this("en");
this("nl");
}