• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

java code for speech to text

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?


 
Bartender
Posts: 4179
22
IntelliJ IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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...)
 
Glen Hynes
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
We can fix it! We just need some baling wire, some WD-40, a bit of duct tape and this tiny ad:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic