Skip to content

Instantly share code, notes, and snippets.

@happasuke
Created February 13, 2016 00:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save happasuke/26bdcb5964e837597ca6 to your computer and use it in GitHub Desktop.
Save happasuke/26bdcb5964e837597ca6 to your computer and use it in GitHub Desktop.
import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.speech.tts.TextToSpeech;
import android.util.Log;
import android.widget.Toast;
public class TTS extends Service implements TextToSpeech.OnInitListener {
public static TextToSpeech mTts;
@Override
public IBinder onBind(Intent intent) {
return null;
}
public void onStart(Intent intent, int startId) {
mTts = new TextToSpeech(this, this);
super.onStart(intent, startId);
}
public void onInit(int status) {
if (status == TextToSpeech.SUCCESS) {
speak("はいはい、バレンタインなんてもういいですから");
} else if (status == TextToSpeech.ERROR) {
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment