Text to Speech Problem

Anfänger2011

Bekanntes Mitglied
Hi alle zusammen,

ich bin in sachen Android programmierung noch ganz am Anfang und arbeite gerade mein Buch dazu durch. Zu einem der ersten Projekte habe ich mal ein bischen rumprobiert, aber das klappt einfach nicht richtig.

Ziel: mehrere Sprachausgaben

Derzeit: nur die letzte wird ausgegeben

Frage:Woran kann das liegen?

Java:
package de.androidnewcomer.saghallo;

import java.util.Locale;

import android.app.Activity;
import android.os.Bundle;
import android.speech.tts.TextToSpeech;
import android.speech.tts.TextToSpeech.OnInitListener;

public class StartActivity extends Activity implements OnInitListener{

    private TextToSpeech tts;
   
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        tts = new TextToSpeech(this, this);
    }
   
    @Override
    public void onDestroy() {
        // Don't forget to shutdown tts!
        if (tts != null) {
            tts.stop();
            tts.shutdown();
        }
        super.onDestroy();
    }
   
    private void speakOut(){
        tts.speak("Hallo. Das hier ist die erste App von Dominik Reimers. " +
                "Sie wird sich in 30 Sekunden selber zerstören. Laufen Sie also schnell weg."
                ,TextToSpeech.QUEUE_FLUSH, null);
       
        for(int x = 30; x >= 0; x--){
            tts.speak(x + " Sekunden",TextToSpeech.QUEUE_FLUSH, null);
        }

        tts.speak("Kabum!",TextToSpeech.QUEUE_FLUSH, null);
    }
   
    @Override
    public void onInit(int status) {
        if(status == TextToSpeech.SUCCESS){
            tts.setLanguage(Locale.GERMAN);
            speakOut();
        }
    }

Viele Grüße Dominik :)
 

Anfänger2011

Bekanntes Mitglied
Falls nochmal jemand das Problem haben sollte ... ich habe das wie folgt gelöst:

-anfangs wird was gesprochen(das hat ja auch gut funktioniert)
-while-Schleife -> da kommt die folgende Abfrage rein
-Abfrage mit isSpeaking() liefert boolean zurück
-hier kommt dann schließlich der nächste zu sprechende Text rein und die Schleife wird beendet

Hoffe das hilft irgenwann Mal jmd ;)
 
Ähnliche Java Themen
  Titel Forum Antworten Datum
R Google Text-to-Speech Android & Cross-Platform Mobile Apps 5
R wie verwende ich Cloud Text-to-Speech? Android & Cross-Platform Mobile Apps 4
R Android Text-To-Speech Android & Cross-Platform Mobile Apps 4
N Gibt es eine opensource Speech-to-Text engine? Android & Cross-Platform Mobile Apps 3
W Edit Text Drawable Icon ändern plus Funktion Android & Cross-Platform Mobile Apps 30
ruutaiokwu Android In einem Android-“Spinner”-Element GLEICHZEITIG Bild (links) UND Text (rechts) anzeigen Android & Cross-Platform Mobile Apps 0
J Android App - Browser öffnen und Text eingeben/Button click auslösen Android & Cross-Platform Mobile Apps 10
M ImageButton: Bild ausblenden und Text anzeigen Android & Cross-Platform Mobile Apps 2
Flynn Text-File auf externe Speicherkarte schreiben Android & Cross-Platform Mobile Apps 1
F Aufkalbbaren Text Android & Cross-Platform Mobile Apps 4
B Android Text von Android zu PC senden? Android & Cross-Platform Mobile Apps 5
C Android Bei Text "Popup" anzeigen Android & Cross-Platform Mobile Apps 2
M Android Edittext width passend zum Text Android & Cross-Platform Mobile Apps 1
L Android Theorie: Umwandeln von Text in Morsecode Android & Cross-Platform Mobile Apps 15
R Android Layout Bild mit Text Android & Cross-Platform Mobile Apps 13
N Android Änderung von tabwidget height lässt text verschwinden Android & Cross-Platform Mobile Apps 3
L Android Text aus Textfeld speichern Android & Cross-Platform Mobile Apps 5
J in android app text automatisch kopieren Android & Cross-Platform Mobile Apps 2
S Android Zufällige Text wiedergabe Android & Cross-Platform Mobile Apps 6
G Android zur Laufzeit den Text im Menü ändern Android & Cross-Platform Mobile Apps 3
K Android schwarzer Bildschirm beim Rendern von Text und Dreiecken Android & Cross-Platform Mobile Apps 9
S Android Canvas - drawText - Update Text in ActionListener Android & Cross-Platform Mobile Apps 8
M Text in txt-Datei schreiben und nach ABC sortieren? Android & Cross-Platform Mobile Apps 2
M Text in Canvas scrollen lassen Android & Cross-Platform Mobile Apps 13
G Text parsen String to Double Android & Cross-Platform Mobile Apps 2
W Prüfen, ob App auf Gerät installiert ist Problem S10 Android & Cross-Platform Mobile Apps 11
W In App Purchase Problem? Android & Cross-Platform Mobile Apps 36
W Problem mit Android Studio Android & Cross-Platform Mobile Apps 0
T Android R.string.test+i Problem Android & Cross-Platform Mobile Apps 2
K Android to Pi | Websocket Problem Android & Cross-Platform Mobile Apps 3
N Intent und finish() Problem Android & Cross-Platform Mobile Apps 5
B Android App Programmierung Einsteiger Problem Android & Cross-Platform Mobile Apps 4
emeraldo Android Problem mit Bottomnavmenu Android & Cross-Platform Mobile Apps 10
I Das Problem mit der Tastatur... android:windowSoftInputMode="adjustPan" Android & Cross-Platform Mobile Apps 1
M Android App → Problem mit dem Speichern von einem Bitmap–Objekt. Android & Cross-Platform Mobile Apps 1
A Android Android Studio Emulator Problem Android & Cross-Platform Mobile Apps 1
S Android Studio Bluetooth App Problem Android & Cross-Platform Mobile Apps 6
J TicTacToe Problem bei kontrolle Android & Cross-Platform Mobile Apps 7
J Button array ID Problem Android & Cross-Platform Mobile Apps 2
M Problem bei Werteübergabe, MSQL verbindung Android & Cross-Platform Mobile Apps 3
S Android Problem mit Android Virtual Device erstellung. Android & Cross-Platform Mobile Apps 2
S Android Android java onclick listener Problem Android & Cross-Platform Mobile Apps 9
A Android Problem mit ListView und OnItemClickListener.. Android & Cross-Platform Mobile Apps 10
K Problem mit arraylist und button Android & Cross-Platform Mobile Apps 16
R W-Lan Problem über Sockets Android & Cross-Platform Mobile Apps 1
P ViewPager Problem Android & Cross-Platform Mobile Apps 1
A Android Problem mit Video von Youtube abspielen Android & Cross-Platform Mobile Apps 4
A Android Problem mit Zurücktaste und ausgabe der Aktuellen Seite Android & Cross-Platform Mobile Apps 6
B Android Problem mit Soundwiedergabe Android & Cross-Platform Mobile Apps 2
T Android Android Sensor: Java Problem Android & Cross-Platform Mobile Apps 1
G Problem beim Rendern von 3D-Objekt Android & Cross-Platform Mobile Apps 0
L Android Gyroscope Sensor Problem Android & Cross-Platform Mobile Apps 2
S Android GPS Problem Android & Cross-Platform Mobile Apps 24
J Eclipse Emulator Problem Android & Cross-Platform Mobile Apps 1
J Eclipse Emulator Problem Android & Cross-Platform Mobile Apps 0
B Android Problem mit Rückgabewert Android & Cross-Platform Mobile Apps 13
L Android komisches Bitmap-Größe-Problem Android & Cross-Platform Mobile Apps 8
D Android Layout Problem Android & Cross-Platform Mobile Apps 2
R Problem mit View in ScrollView Android & Cross-Platform Mobile Apps 6
R Eclipse + AndroidSDK - Problem mit Referenzen Android & Cross-Platform Mobile Apps 6
M Problem mit setOnClickListener Android & Cross-Platform Mobile Apps 4
DaniSahne96 Problem beim Appdebuggen auf Smartphone Android & Cross-Platform Mobile Apps 3
P Android Problem beim Widget - Denkfehler ? Android & Cross-Platform Mobile Apps 2
M GCM IntentService Problem Android & Cross-Platform Mobile Apps 3
D Android Gallery Problem Android & Cross-Platform Mobile Apps 5
P Problem mit Cell id Android & Cross-Platform Mobile Apps 6
L Android Problem mit "spinner" Android & Cross-Platform Mobile Apps 10
D Android problem mit geschwindigkeitsberechnung app Android & Cross-Platform Mobile Apps 2
E Android Problem mit Contact Provider Android & Cross-Platform Mobile Apps 1
H Android Problem mit ListActivity Android & Cross-Platform Mobile Apps 3
S Android Layout Problem mit fill_parent Android & Cross-Platform Mobile Apps 5
F Android ExpandableList, SimpleCursorTreeAdapter, Cursor Problem Android & Cross-Platform Mobile Apps 2
A Android Problem mit Long.getLong() bzw. Integer.getInteger() Android & Cross-Platform Mobile Apps 2
A Problem mit HTTP- Verbindung Android & Cross-Platform Mobile Apps 4
V [Java] und [JavaME] ClientServer StreamConnection . Problem beim lesen / schreiben Android & Cross-Platform Mobile Apps 2
F Eclipse JAD File erzeugen -- Problem Android & Cross-Platform Mobile Apps 10
R Ein Problem beim ausführen von folgendem Quelltext Android & Cross-Platform Mobile Apps 11
M Problem mit dem Auslesen von System Properties Android & Cross-Platform Mobile Apps 7
P wtk problem Android & Cross-Platform Mobile Apps 3
G Math exp() Problem Android & Cross-Platform Mobile Apps 4
G S40 Problem Android & Cross-Platform Mobile Apps 8
A Problem beim Subtrahieren eines Double von einem Double Android & Cross-Platform Mobile Apps 5
C Problem Device/Emulator wird nicht erkannt Android & Cross-Platform Mobile Apps 3
S Image Problem Android & Cross-Platform Mobile Apps 11
M Problem mit den Softkeys Android & Cross-Platform Mobile Apps 4
G J2ME jar-problem Android & Cross-Platform Mobile Apps 10
S Komisches Problem Android & Cross-Platform Mobile Apps 3
F Problem beim Erstellen der Jar File Android & Cross-Platform Mobile Apps 4
A Problem: Canvas-Grösse Motorola RAZR v3r Android & Cross-Platform Mobile Apps 8
S Problem mit Einbindung einer externer Bibliothek Android & Cross-Platform Mobile Apps 2
G Random - Problem Android & Cross-Platform Mobile Apps 5
E problem mit den resourcen Android & Cross-Platform Mobile Apps 2
O Problem mit Datagramconnection Android & Cross-Platform Mobile Apps 2
P Problem mit der Uhrzeit Android & Cross-Platform Mobile Apps 2
S Problem auf dem Handy Android & Cross-Platform Mobile Apps 3

Ähnliche Java Themen

Neue Themen


Oben