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 7604357
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T23:53:22+00:00 2026-05-30T23:53:22+00:00

My activity’s onInit() contains a call to TextToSpeech.setEngineByPackageName() : tts = new TextToSpeech(this, this);

  • 0

My activity’s onInit() contains a call to TextToSpeech.setEngineByPackageName():

  tts = new TextToSpeech(this, this);
  tts.setEngineByPackageName("com.ivona.tts.voicebeta.eng.usa.kendra");

It works on an Android 2.2.2 device, but on an Android 2.3.4 device it produced a NullPointerException, with the following stack trace:

 E/TextToSpeech.java - setEngineByPackageName(3423): NullPointerException
 W/System.err(3423): java.lang.NullPointerException
 W/System.err(3423):    at android.os.Parcel.readException(Parcel.java:1328)
 W/System.err(3423):    at android.os.Parcel.readException(Parcel.java:1276)
 W/System.err(3423):    at android.speech.tts.ITts$Stub$Proxy.setEngineByPackageName(ITts.java:654)
 W/System.err(3423):    at android.speech.tts.TextToSpeech.setEngineByPackageName(TextToSpeech.java:1356)

Since I am providing a hard-coded string parameter, I know that the parameter isn’t what’s causing the NullPointerException.

I also know that setEngineByPackageName() is deprecated but that’s only since API 14, so this couldn’t be the reason.

Any idea what could be causing this NullPointerException?

EDIT: I wouldn’t have been concerned with the “why” if this didn’t result in an endless bombardment of:

I/TextToSpeech.java(3652): initTts() successfully bound to service

Followed by calls to onInit() (by the system, not by my code).

My hope is that if I underderstand why this is happening, I can stop the bombardment of onInit()s and recover gracefully from the error.

  • 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-30T23:53:24+00:00Added an answer on May 30, 2026 at 11:53 pm

    Is the TTS engine you are referencing installed on the 2.3.4 device? If it is, it might be a platform bug.

    EDIT:
    Don’t remember what results I got when I did this, but calling setEngineByPackageName() when the package doesn’t exists is not a good idea. Check if it is installed and don’t try to use it if it’s not. Something like:

    boolean isPackageInstalled(String packageName) {
      PackageManager pm = context.getPackageManager();
      try {
        PackageInfo pi = pm.getPackageInfo(packageName, 0);
    
        return pi != null;
      } catch (NameNotFoundException e) {
        return false;
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

first activity: String s=create_newfile; Intent i = new Intent(com.monster.android.Showfile); Bundle extras = new Bundle();
This activity is used for login. It post the username and password to a
Problem: Activity A is a ListView that contains a ListAdapter , and clicking in
I have an camera Activity like this: public void startCamera() { Log.d(ANDRO_CAMERA, Starting camera
function Activity() { this.LoadFile = function (path, targetElement) { $.ajax({ url: path, dataType: 'html',
The Activity Lifecycle is giving me headaches. The documentation at http://developer.android.com/reference/android/app/Activity.html is so darn
Main Activity Code. BroadcastExample.java package com.example.broadcast; import android.app.Activity; import android.os.Bundle; import android.util.Log; public class
My Activity is getting close on rotation. Don't know why? Also i checked this
Activity: package hi.com; import android.app.Activity; import android.content.ContentValues; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteException; import
My Activity locks its orientation by using setRequestedOrientation(). However, once this is set to

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.