Hi,
I can successfully call the code below from the parent process with
speaker.sayHello() and it works as expected. What I want to do is to
call speaker.sayHello() from a livewallpaper rather than a foreground
activity. I've tried to start the activity with this code in the
parent :-
Intent i = new Intent(context, speaker.class);
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(i);
after removing these lines from the manifest :-
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category
android:name="android.intent.category.LAUNCHER" />
</intent-filter>
but I get a Force Close. Can somebody point out what I'm doing wrong.
Thanks,
Simon.
speaker.java :-
import android.speech.tts.*;
import android.app.Activity;
import android.os.Bundle;
public class speaker extends Activity {
/** Called when the activity is first created. */
private static TextToSpeech myTts;
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
myTts = new TextToSpeech(this, ttsInitListener);
}
private TextToSpeech.OnInitListener ttsInitListener = new
TextToSpeech.OnInitListener() {
public void onInit(int version) {
}
};
public static void sayHello()
{
String myText1 = "Hello";
myTts.speak(myText1, 0, null);
}
}
AndroidManifest.xml :-
<activity android:name=".speaker"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category
android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
To unsubscribe, reply using "remove me" as the subject.