Hi, I wanna show you how you can use the capability of Android phones to speach any text.
You don’t need to be an engineer of sound or something like this. This can be done VERY easy using Android API classes.
So you need just to give users an EditText widget. You grab the text inputed like this:
String myText= edittext.getText().toString();
Now you have in variable string the inputed user text and you need to “speak it”.
You create a new project in android and in the main class will look like this:
package com.androidgenuine.texttospeach; import android.app.Activity; import android.os.Bundle; import android.speech.tts.TextToSpeech; import android.speech.tts.TextToSpeech.OnInitListener; public class Main extends Activity implements OnInitListener { private TextToSpeech mytts; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mytts = new TextToSpeech(this, this); } @Override public void onInit(int init) { String myText="My first String speach";//here you can replace this example with the text grabbed from //an EditText if (init == TextToSpeech.SUCCESS) { mytts.speak(myText, TextToSpeech.QUEUE_FLUSH, null); } }
Do not forget that users must have installed TextToSpeach library from Market.