Win a copy of Java Persistence with Spring Data and Hibernate this week in the Spring forum!
  • 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
  • Ron McLeod
  • Tim Cooke
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Jeanne Boyarsky
Saloon Keepers:
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Piet Souris
Bartenders:

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: 77541
372
  • 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.
 
What are your superhero powers? Go ahead and try them on this tiny ad:
The Low Tech Laboratory Movie Kickstarter is LIVE NOW!
https://www.kickstarter.com/projects/paulwheaton/low-tech
reply
    Bookmark Topic Watch Topic
  • New Topic