Commit 0dee671b authored by Martin LOISEAU's avatar Martin LOISEAU 🎄
Browse files

Add TTS demo

parent 98f199dd
......@@ -9,19 +9,31 @@ import;
import androidx.appcompat.widget.Toolbar;
import android.os.Environment;
import android.speech.tts.TextToSpeech;
import android.util.Log;
import android.view.View;
import android.view.Menu;
import android.view.MenuItem;
import java.util.Locale;
public class MainActivity extends AppCompatActivity {
MediaPlayer mp;
TextToSpeech tts;
protected void onCreate(Bundle savedInstanceState) {
Toolbar toolbar = findViewById(;
tts = new TextToSpeech(this, new TextToSpeech.OnInitListener() {
public void onInit(int status) {
FloatingActionButton photo = findViewById(;
// Should open camera to take a picture of a QR code
......@@ -40,6 +52,7 @@ public class MainActivity extends AppCompatActivity {
public void onClick(View view) {
Snackbar.make(view, "Should read some text out loud using speech synthesis", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
......@@ -94,4 +107,10 @@ public class MainActivity extends AppCompatActivity {
return true;
public boolean PlayDemoTTS() {
tts.speak("Bonjour et bienvenue dans QR Quest", TextToSpeech.QUEUE_ADD, null);
return true;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment