hello all. the code below is used to convert speech to text on an android app. This code works when the speech button is pressed and whatever you say is transferred into text.
When the speech function closes, the the text is showing.
If you hit the speech button again, the previous text is cleared and the new text shows on the page.
Can anyone help me edit the code so that the previous texts remain on the page?
The general strategy would be to get the previous text, append the new String to the old text, then add the text back to the TextView. It may be a little more complicated because you probably want to add a line break, and maybe other conditions (like a fixed number of lines to display, scrolling, or something.
An alternative to the TextView which may better match your goals might be to use a ListView. The ListView can be bound to an ArrayAdapter. Whenever you get a String you would add it to the ArrayAdapter, which would cause the ListView to expand to accommodate the new text. It makes it easier to control the values which get displayed (the number of lines, formatting, etc...)
Joined: Jan 05, 2013
Thanks. this sounds like exactly what i need. now to go and try write this into the code! i am a beginner with java so any help appreciated.