Locale and TTS problem

by jax » Sun, 01 Nov 2009 12:37:05 GMT


Sponsored Links
 I have set my emulator to use US English.

When I run Locale.getDefault()

There is no country code!
The language code is set to "en_us"

When I set a varaible "audioLocale" using

audioLocale= Locale.US

The country code is "US"
The language code is "en"

When I run

mTts.isLanguageAvailable(audioLocale) == TextToSpeech.LANG_AVAILABLE

I get

-2 == 0

Why is mTts reporting that the US language is not available?


--



Other Threads

1. need to send audio file during a call

I have an app through which I can make a call to a number. What I want
is to send an prerecorded message or audio file which the receiver
will hear once he receive the call. Can any one help me.?....

here is my code...

package com.DialANumber;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;

public class DialANumber extends Activity {
        EditText mEditText_number = null;
        LinearLayout mLinearLayout_no_button = null;
        Button mButton_dial = null;

        /** Called when the activity is first created. */
        @Override
        public void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);

                mLinearLayout_no_button = new LinearLayout(this);

                mEditText_number = new EditText(this);
                mEditText_number.setText("9830...132"); // my number
                mLinearLayout_no_button.addView(mEditText_number);

    mButton_dial = new Button(this);
    mButton_dial.setText("Dial!");
    mLinearLayout_no_button.addView(mButton_dial);
    mButton_dial.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
                performDial();
        }
    });

    setContentView(mLinearLayout_no_button);
        }

  public boolean onKeyDown(int keyCode, KeyEvent event) {
    if (keyCode == KeyEvent.KEYCODE_CALL) {
        performDial();
       return true;
    }
    return false;
}

        public void performDial(){
                if(mEditText_number!=null){
                        try {
                                Log.e("started", "hi");
                                startActivity(new Intent(Intent.ACTION_CALL, 
Uri.parse("tel:" +
mEditText_number.getText())));

                        } catch (Exception e) {
                                e.printStackTrace();
                        }
                }//if
        }
}

-- 

2. NullPointerException while building android app using ant.

Hi All,

While building the android app using ant am getting the following
exception. Couldn't figure out why these exception are thrown!!!

Execute:Java13CommandLauncher: Executing 'D:\Android-2.0\android-sdk-
windows\platforms\android-1.5\tools\aapt.exe' with arguments:
'package' '-f' '-M' 'E:\manish_test\timetrack\client\static\android
\AndroidManifest.xml' '-S' 'E:\manish_test\timetrack\client\static
\android\res' '-A' 'E:\manish_test\timetrack\client\static\android
\assets' '-I' 'D:\Android-2.0\android-sdk-windows\platforms
\android-1.5\android.jar' '-F' 'C:\CLIENT_BUILDS\QA\3.0.9\Android\11-
Feb-2010_b1\XoraTimeTrack.ap_'

The ' characters around the executable and arguments are not part of
the command. [null] (skipping index file 'E:\manish_test\timetrack
\client\static\android\res\drawable\Thumbs.db') Class
org.apache.tools.ant.Project loaded from parent loader (parentFirst)
Finding class com.android.sdklib.internal.project.ProjectProperties
$PropertyType Loaded from D:\Android-2.0\android-sdk-windows\tools\lib
\sdklib.jar com/android/sdklib/internal/project/ProjectProperties
$PropertyType.class Class java.lang.Enum loaded from parent loader
(parentFirst) Class
com.android.sdklib.internal.project.ProjectProperties$PropertyType
loaded from ant loader (parentFirst) Finding class
com.android.sdklib.internal.project.ProjectProperties Loaded from D:
\Android-2.0\android-sdk-windows\tools\lib\sdklib.jar com/android/
sdklib/internal/project/ProjectProperties.class Class
com.android.sdklib.internal.project.ProjectProperties loaded from ant
loader (parentFirst) Class java.util.Map loaded from parent loader
(parentFirst) Class java.io.OutputStream loaded from parent loader
(parentFirst) Class java.io.FileOutputStream loaded from parent loader
(parentFirst) Class java.lang.Throwable loaded from parent loader
(parentFirst) Class java.lang.AssertionError loaded from parent loader
(parentFirst) Class java.lang.Class loaded from parent loader
(parentFirst) Class java.util.HashMap loaded from parent loader
(parentFirst) Finding class
com.android.sdklib.internal.project.ApkConfigurationHelper Loaded from
D:\Android-2.0\android-sdk-windows\tools\lib\sdklib.jar com/android/
sdklib/internal/project/ApkConfigurationHelper.class Class
com.android.sdklib.internal.project.ApkConfigurationHelper loaded from
ant loader (parentFirst) Finding class
com.android.sdklib.internal.project.ApkSettings Loaded from D:
\Android-2.0\android-sdk-windows\tools\lib\sdklib.jar com/android/
sdklib/internal/project/ApkSettings.class Class
com.android.sdklib.internal.project.ApkSettings loaded from ant loader
(parentFirst) [antcall] Exiting E:\manish_test\timetrack\build\build-
Android-1.0.xml.

BUILD FAILED E:\manish_test\timetrack\build\build-Android-1.0.xml:371:
The following error occurred while executing this line: E:\manish_test
\timetrack\build\build-Android-1.0.xml:302:
java.lang.NullPointerException at
org.apache.tools.ant.ProjectHelper.addLocationToBuildException(ProjectHelper.java:
508) at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:418) at
org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:105)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:
288) at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source) at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25) at java.lang.reflect.Method.invoke(Method.java:597) at
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:
106) at org.apache.tools.ant.Task.perform(Task.java:348) at
org.apache.tools.ant.Target.execute(Target.java:357) at
org.apache.tools.ant.Target.performTasks(Target.java:385) at
org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
at org.apache.tools.ant.Project.executeTarget(Project.java:1306) at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:
41) at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
at org.apache.tools.ant.Main.runBuild(Main.java:758) at
org.apache.tools.ant.Main.startAnt(Main.java:217) at
org.apache.tools.ant.launch.Launcher.run(Launcher.java:257) at
org.apache.tools.ant.launch.Launcher.main(Launcher.java:104) Caused
by: E:\manish_test\timetrack\build\build-Android-1.0.xml:302:
java.lang.NullPointerException at
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:
116) at org.apache.tools.ant.Task.perform(Task.java:348) at
org.apache.tools.ant.Target.execute(Target.java:357) at
org.apache.tools.ant.Target.performTasks(Target.java:385) at
org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
at
org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:
38) at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:416) ... 17 more
Caused by: java.lang.NullPointerException at
com.android.sdklib.internal.project.ApkConfigurationHelper.getSettings(ApkConfigurationHelper.java:
31) at com.android.ant.AaptExecLoopTask.execute(AaptExecLoopTask.java:
137) at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source) at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25) at java.lang.reflect.Method.invoke(Method.java:597) at
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:
106) ... 24 more --- Nested Exception --- E:\manish_test\timetrack
\build\build-Android-1.0.xml:302: java.lang.NullPointerException at
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:
116) at org.apache.tools.ant.Task.perform(Task.java:348) at
org.apache.tools.ant.Target.execute(Target.java:357) at
org.apache.tools.ant.Target.performTasks(Target.java:385) at
org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
at
org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:
38) at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:416) at
org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:105)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:
288) at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source) at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25) at java.lang.reflect.Method.invoke(Method.java:597) at
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:
106) at org.apache.tools.ant.Task.perform(Task.java:348) at
org.apache.tools.ant.Target.execute(Target.java:357) at
org.apache.tools.ant.Target.performTasks(Target.java:385) at
org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
at org.apache.tools.ant.Project.executeTarget(Project.java:1306) at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:
41) at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
at org.apache.tools.ant.Main.runBuild(Main.java:758) at
org.apache.tools.ant.Main.startAnt(Main.java:217) at
org.apache.tools.ant.launch.Launcher.run(Launcher.java:257) at
org.apache.tools.ant.launch.Launcher.main(Launcher.java:104) Caused
by: java.lang.NullPointerException at
com.android.sdklib.internal.project.ApkConfigurationHelper.getSettings(ApkConfigurationHelper.java:
31) at com.android.ant.AaptExecLoopTask.execute(AaptExecLoopTask.java:
137) at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source) at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25) at java.lang.reflect.Method.invoke(Method.java:597) at
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:
106) ... 24 more --- Nested Exception ---
java.lang.NullPointerException at
com.android.sdklib.internal.project.ApkConfigurationHelper.getSettings(ApkConfigurationHelper.java:
31) at com.android.ant.AaptExecLoopTask.execute(AaptExecLoopTask.java:
137) at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source) at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25) at java.lang.reflect.Method.invoke(Method.java:597) at
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:
106) at org.apache.tools.ant.Task.perform(Task.java:348) at
org.apache.tools.ant.Target.execute(Target.java:357) at
org.apache.tools.ant.Target.performTasks(Target.java:385) at
org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
at
org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:
38) at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:416) at
org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:105)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:
288) at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source) at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25) at java.lang.reflect.Method.invoke(Method.java:597) at
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:
106) at org.apache.tools.ant.Task.perform(Task.java:348) at
org.apache.tools.ant.Target.execute(Target.java:357) at
org.apache.tools.ant.Target.performTasks(Target.java:385) at
org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
at org.apache.tools.ant.Project.executeTarget(Project.java:1306) at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:
41) at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
at org.apache.tools.ant.Main.runBuild(Main.java:758) at
org.apache.tools.ant.Main.startAnt(Main.java:217) at
org.apache.tools.ant.launch.Launcher.run(Launcher.java:257) at
org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)

-- 

3. Problem with install APK's shared library

4. Reg Monkey and Watchdog issue

5. Features supported in Android's Webkit borwser

6. Change Ringtone progrmatically

7. Text Box on Camera View