Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7514107
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T00:23:45+00:00 2026-05-30T00:23:45+00:00

I am trying make such application which speak automatically when the image loaded it

  • 0

I am trying make such application which speak automatically when the image loaded it self.
I had tried a single application (example) of TTS which is working properly but this code gives me
My Code is Text To Speech service isn’t started.

public class show_image extends Activity implements TextToSpeech.OnInitListener {

Intent mIntent;
String value;
ImageView mImageView;
private TextToSpeech tts;
int j;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    mIntent = getIntent();
    Bundle b = getIntent().getExtras();
    final String name = b.getString("name");
    j = name.toCharArray()[0];

    tts = new TextToSpeech(this, this);
    tts.speak("Welcome", TextToSpeech.QUEUE_ADD, null);
    mImageView = (ImageView) findViewById(R.id.imageView1);

    switch (j) {
    case 65:
        mImageView.setBackgroundResource(R.drawable.a);
        tts.speak(name + " for Apple", TextToSpeech.QUEUE_ADD, null);
        // Toast.makeText(getApplicationContext(),
        // "Saying:" + name + " for Apple", Toast.LENGTH_SHORT)
        // .show();
        tts.isLanguageAvailable(Locale.ENGLISH);
        break;
    case 66:
        mImageView.setBackgroundResource(R.drawable.b);
        tts.speak(name + "for Bluetooth", TextToSpeech.QUEUE_ADD, null);
        break;
    case 67:
        mImageView.setBackgroundResource(R.drawable.c);
        tts.speak(name + "for Chat", TextToSpeech.QUEUE_ADD, null);
        break;
    case 68:
        mImageView.setBackgroundResource(R.drawable.d);
        tts.speak(name + "for Download", TextToSpeech.QUEUE_ADD, null);
        break;
    case 69:
        mImageView.setBackgroundResource(R.drawable.e);
        tts.speak(name + "for E Mail", TextToSpeech.QUEUE_ADD, null);
        break;
    case 70:
        mImageView.setBackgroundResource(R.drawable.f);
        tts.speak(name + "for Facebook", TextToSpeech.QUEUE_ADD, null);
        break;
    case 71:
        mImageView.setBackgroundResource(R.drawable.g);
        tts.speak(name + "for Google", TextToSpeech.QUEUE_ADD, null);
        break;
    case 72:
        mImageView.setBackgroundResource(R.drawable.h);
        tts.speak(name + "for Hewlwtt Packard", TextToSpeech.QUEUE_ADD,
                null);
        break;
    case 73:
        mImageView.setBackgroundResource(R.drawable.i);
        tts.speak(name + "for Iphone", TextToSpeech.QUEUE_ADD, null);
        break;
    case 74:
        mImageView.setBackgroundResource(R.drawable.j);
        tts.speak(name + "for Java", TextToSpeech.QUEUE_ADD, null);
        break;
    case 75:
        mImageView.setBackgroundResource(R.drawable.k);
        tts.speak(name + "for kingston", TextToSpeech.QUEUE_ADD, null);
        break;
    case 76:
        mImageView.setBackgroundResource(R.drawable.l);
        tts.speak(name + "for Laptop", TextToSpeech.QUEUE_ADD, null);
        break;
    case 77:
        mImageView.setBackgroundResource(R.drawable.m);
        tts.speak(name + "for Messenger", TextToSpeech.QUEUE_ADD, null);
        break;
    case 78:
        mImageView.setBackgroundResource(R.drawable.n);
        tts.speak(name + "for Nero", TextToSpeech.QUEUE_ADD, null);
        break;
    case 79:
        mImageView.setBackgroundResource(R.drawable.o);
        tts.speak(name + "for Orkut", TextToSpeech.QUEUE_ADD, null);
        break;
    case 80:
        mImageView.setBackgroundResource(R.drawable.p);
        tts.speak(name + "for Picassa", TextToSpeech.QUEUE_ADD, null);
        break;
    case 81:
        mImageView.setBackgroundResource(R.drawable.q);
        tts.speak(name + "for Quick Heal", TextToSpeech.QUEUE_ADD, null);
        break;
    case 82:
        mImageView.setBackgroundResource(R.drawable.r);
        tts.speak(name + "for Ram", TextToSpeech.QUEUE_ADD, null);
        break;
    case 83:
        mImageView.setBackgroundResource(R.drawable.s);
        tts.speak(name + "for Server", TextToSpeech.QUEUE_ADD, null);
        break;
    case 84:
        mImageView.setBackgroundResource(R.drawable.t);
        tts.speak(name + "for Twitter", TextToSpeech.QUEUE_ADD, null);
        break;
    case 85:
        mImageView.setBackgroundResource(R.drawable.u);
        tts.speak(name + "for Usb", TextToSpeech.QUEUE_ADD, null);
        break;
    case 86:
        mImageView.setBackgroundResource(R.drawable.v);
        tts.speak(name + "for Vista", TextToSpeech.QUEUE_ADD, null);
        break;
    case 87:
        mImageView.setBackgroundResource(R.drawable.w);
        tts.speak(name + "for WiFi", TextToSpeech.QUEUE_ADD, null);
        break;
    case 88:
        mImageView.setBackgroundResource(R.drawable.x);
        tts.speak(name + "for XP", TextToSpeech.QUEUE_ADD, null);
        break;
    case 89:
        mImageView.setBackgroundResource(R.drawable.y);
        tts.speak(name + "for Youtube", TextToSpeech.QUEUE_ADD, null);
        break;
    case 90:
        mImageView.setBackgroundResource(R.drawable.z);
        tts.speak(name + "for Zorpia", TextToSpeech.QUEUE_ADD, null);
        break;
    default:
        break;
    }

    Intent checkIntent = new Intent();
    checkIntent.setAction(TextToSpeech.Engine.ACTION_CHECK_TTS_DATA);
    startActivityForResult(checkIntent, RESULT_OK);

    final Thread t1 = new Thread() {
        public void run() {
            try {

                Thread.sleep(10000);
                finish();
                // this.destroy();
            } catch (Exception e) {
                // TODO Auto-generated catch block
                Toast.makeText(getApplicationContext(), e.getMessage(),
                        Toast.LENGTH_SHORT).show();
            }
        }
    };
    t1.start();
}

protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == RESULT_OK) {
        if (resultCode == TextToSpeech.Engine.CHECK_VOICE_DATA_PASS) {
            // success, create the TTS instance
            tts = new TextToSpeech(this, this);
        } else {
            // missing data, install it
            Intent installIntent = new Intent();
            installIntent
                    .setAction(TextToSpeech.Engine.ACTION_INSTALL_TTS_DATA);
            startActivity(installIntent);
        }
    }

}

public void onInit(int status) {
    if (status == TextToSpeech.SUCCESS) {
        Toast.makeText(this,
                "Write and Listen engine is initialized & Ready",
                Toast.LENGTH_LONG).show();
    } else if (status == TextToSpeech.ERROR) {
        Toast.makeText(this,
                "Error occurred while initializing Text-To-Speech engine",
                Toast.LENGTH_LONG).show();
    }
}

protected void onDestroy() {
    super.onDestroy();
    if (tts != null) {
        tts.shutdown();
    }
}

}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T00:23:48+00:00Added an answer on May 30, 2026 at 12:23 am

    In OnCreate You have Written this code,

        tts = new TextToSpeech(this, this); 
        tts.speak("Welcome", TextToSpeech.QUEUE_ADD, null); 
        mImageView = (ImageView) findViewById(R.id.imageView1); 
    

    At that time Engine is not installed so it Gives error and Quit and never goes to install the Engine,

    So First task to do in OnCreate should be,

        Intent checkIntent = new Intent(); 
        checkIntent.setAction(TextToSpeech.Engine.ACTION_CHECK_TTS_DATA); 
        startActivityForResult(checkIntent, RESULT_OK); 
    

    Which you are doing long after and trying to speak before it’s installed

    So write that intent for Engine Check as first line in onCreate.Everything else is Fine I see.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to make a component for an application which a user can
I'm trying to make an application which allows the user to draw shapes to
i am trying to make the preloading work in such a way that the
Trying to make a MySQL-based application support MS SQL, I ran into the following
trying to make a page which will recursively call a function until a limit
I am trying to set up a layout as such in an iPad application.
I've developed a Qt application which contains a TCP server and such. I'm now
I'm trying to make a simple application in C# that allows me to kill
I am trying to make a system tray application that loads on startup and
I'm building a WPF application in which I need to display document previews such

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.