Back to project page colorishi.
The source code is released under:
GNU General Public License
If you think the Android project colorishi listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.github.colorishi; /* w w w . j a v a 2 s.co m*/ import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.speech.tts.TextToSpeech; import android.view.Window; import android.view.WindowManager; import java.util.Locale; public class Main extends Activity implements TextToSpeech.OnInitListener { public static final int CHECK_TTS = 10; private ColorChangingView view; private TextToSpeech mTts; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); view = new ColorChangingView(this); setContentView(view); Intent checkIntent = new Intent(); checkIntent.setAction(TextToSpeech.Engine.ACTION_CHECK_TTS_DATA); startActivityForResult(checkIntent, CHECK_TTS); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == CHECK_TTS) { if (resultCode == TextToSpeech.Engine.CHECK_VOICE_DATA_PASS) { mTts = new TextToSpeech(this, this); } else { Intent installIntent = new Intent(); installIntent.setAction(TextToSpeech.Engine.ACTION_INSTALL_TTS_DATA); startActivity(installIntent); } } } public void onInit(int i) { mTts.setLanguage(Locale.US); view.setTts(mTts); } @Override public void onBackPressed() { } }