1. Are you ready for the Galaxy S20? Here is everything we know so far!

Help with scripts for my text-to-speech app

Discussion in 'Android Development' started by mehboob, Sep 12, 2011.

  1. mehboob

    mehboob Lurker
    Thread Starter

    Am new to android world and working on text-to-speech app, I got struck in between this app, The problem is my activity-2 image is appearing on screen before my activity-1 has completed reading its content.When i use the following code activity-2 is not starting at all.Any help would be appreciated :).Thanks

    if (status == TextToSpeech.SUCCESS) {

    String text= tt.getText().toString();
    if (text!=null && text.length()>0) {
    Toast.makeText(activity1.this, "Speaking: " + text, Toast.LENGTH_LONG).show();

    HashMap<String, String> myHash = new HashMap();

    tts.speak(text, TextToSpeech.QUEUE_ADD, myHash);
    else if (status == TextToSpeech.ERROR) {
    "Error occurred while initializing Text-To-Speech engine", Toast.LENGTH_LONG).show();

    } public void onUtteranceCompleted(String t) {

    if(t == "completed"){
    Intent i = new Intent(this, activity2.class);

    1. Download the Forums for Android™ app!



Share This Page