Android Text To Speech Example
DOWNLOAD SOURCE CODE
Actually that’s the whole code.
You just need to create a TextToSpeech object.
this code text to speech simple example code
SOURCE CODE
public class MainActivity extends Activity implements OnInitListener {
TextToSpeech textTalker;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button tv=(Button)findViewById(R.id.button1);
textTalker = new TextToSpeech(this, this);
tv.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
EditText et=(EditText)findViewById(R.id.editText1);
textTalker.speak(et.getText().toString(), TextToSpeech.SUCCESS, null);
}
});
}
@Override
public void onDestroy() {
if (textTalker != null) {
textTalker.stop();
textTalker.shutdown();
}
super.onDestroy();
}
public void onInit(int status) {
// TODO Auto-generated method stub
}
}
DOWNLOAD SOURCE CODE
Actually that’s the whole code.
You just need to create a TextToSpeech object.
this code text to speech simple example code
SOURCE CODE
public class MainActivity extends Activity implements OnInitListener {
TextToSpeech textTalker;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button tv=(Button)findViewById(R.id.button1);
textTalker = new TextToSpeech(this, this);
tv.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
EditText et=(EditText)findViewById(R.id.editText1);
textTalker.speak(et.getText().toString(), TextToSpeech.SUCCESS, null);
}
});
}
@Override
public void onDestroy() {
if (textTalker != null) {
textTalker.stop();
textTalker.shutdown();
}
super.onDestroy();
}
public void onInit(int status) {
// TODO Auto-generated method stub
}
}
hi sir, i am making an application of text to speech in android. is there a source code of syllabification process? thanks in advance..
ReplyDeletethis is not working
ReplyDeletewhen i enter text and clicked on button...nothing haapend..............
ReplyDeleteif its not working then repalce it
ReplyDeleteextTalker.speak(et.getText().toString(), TextToSpeech.SUCCESS, null);
WITH IT
textTalker.speak(intentDataHolder.getString("MsgTxt"), TextToSpeech.QUEUE_ADD, null);
Now it will surely work.....
Doesn't work even with the TextToSpeech.QUEUE_ADD - dude, test your code before posting.
ReplyDeletehi , this code working for me . once again test it.
ReplyDeletethis code worked 4 me to......u should test it again...
ReplyDeleteI need Codinng 4 Speech to Text
ReplyDeletehey sir.
ReplyDeletei also need coding 4 speech to text...
Cool Man!! Thanks a lot, Even this http://www.compiletimeerror.com/2013/08/text-to-speech-in-android.html might help you out, have a look..
ReplyDelete