• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Android getting EditText content from a while loop in seperate method

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In my problem, I have my MainActivity, with a TextView and EditText, and a Thread, excecuting a method, which should send out messages to the TextView and receive the content of an EditText. The problem is receiving text from the EditText, since it throws the exception:

android.view.ViewRoot$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.

I have looked at the possibilities of runAsUiThread() and Handler, but i haven't found a solution to pass the content of the EditText yet.

Have I overseen a possibility with the Handler to pass content back, or is there some other solution here?

I'll try to post my cropped code so you will gain some knowledge about what I am trying to achieve.



Any help is greatly appreciated.
 
Marshal
Posts: 79406
377
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch
You have arrived in the wrong place; this forum is for discussing the website itself. I shall try moving you to the Android forum and see whether people there can help.
 
The government thinks you are too stupid to make your own lightbulb choices. But this tiny ad thinks you are smart:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic