• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Change TextView from Thread

Nagare

Lurker
Hi everybody!

I have a problem showing the connection state in my UI. First, I describe my situation:

I have an activity and a service. My main Activity launches the service and it connects to a Web service. Depends the response, the service take a state which i need to show in the UI.

For verifying the state of Service, the Activity creates a Thread, that asks for it each 10 seconds. It gets the result in a message and then launches a handler to evaluate the message and the handler modifies the TextView.

When I run the application, the system says me "System.err﹕ android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views."

I don't know how I can do it. Can everybody help me? Sorry for my english.

Thanks in advance.
 
Back
Top Bottom