the question is as above.
scenario : i programmatically created table rows with text view in it. i wanted to allow text-to-speech when i clicked on the textview. there is some reason for not using listview. i tried to use button for easier usage, however the button that i created is always out of the dimension that gave. so, i wanted to use textview to activate the TTS.
how do i do that ?
i tried using
tv.setOnClickListener(new OnClickListener()
{
public void OnClick(View v)
{
String speech = list.get(i).toString();
tts.speak(speech,TextToSpeech.QUEUE_FLUSH,null);
}
});
i uses for-loop for it, so that it will create a table row for every data collected. the problem is, it requested the “i” to be final. and when i made it final, i cant use i++.
please help. thanks alot =)
Try to declare your
int i;in your class. I believe this will help you to avoid of using final modifier.or put this code
String speech = list.get(i).toString();to another method. for example:tts.speak(speech,TextToSpeech.QUEUE_FLUSH,null);
__