Say “Hello, world!”

In this example, we use the Interaction service to set up a Say action, in order to make the robot say something.

import android.os.Bundle;
import android.util.Log;

import com.aldebaran.qi.QiCallback;
import com.aldebaran.qi.sdk.Qi;
import com.aldebaran.qi.sdk.object.interaction.Say;

public class SayActivity extends Activity {

    private static final String TAG = "SayActivity";

    protected void onCreate(Bundle savedInstanceState) {

        Say say = new Say(this);"Hello, world!").then(Qi.onUiThread(new QiCallback<Void>() {
            public void onResult(Void ignore) {
                Log.d(TAG, "result on thread " + Thread.currentThread().getName());

            public void onError(Throwable error) {
                Log.e(TAG, "error", error);

            public void onCancel() {
                Log.w(TAG, "cancel");