• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Android getting EditText content from a while loop in seperate method

 
Michael Swann
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • 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.
 
Campbell Ritchie
Sheriff
Posts: 51467
87
  • Likes 1
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic