Reputation: 785
06-28 12:07:10.881: E/(930): {total=21 secs, date2=28-06-2012, time2=9:43:09 AM, time1=9:42:48 AM, date1=28-06-2012}
06-28 12:07:11.131: E/testing(930): exception:android.view.ViewRoot$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.
06-28 12:07:11.160: E/(930): {total=24 secs, date2=28-06-2012, time2=10:45:02 AM, time1=10:44:38 AM, date1=28-06-2012}
06-28 12:07:11.601: E/testing(930): exception:java.lang.IllegalArgumentException: The observer is null.
Upvotes: 1
Views: 129
Reputation: 31466
You can use threads but all the views, and all the views related APIs, must be invoked from the main thread (also called UI thread.) To do this from a background thread, you need to use a Handler. A Handler is an object that will post messages back to the UI thread for you.
Upvotes: 0
Reputation: 3521
Look at code that is written in a seprate thread and is trying to update your application UI.
You need to put that code in run method of runOnUiThread
.
runOnUiThread(new Runnable() {
public void run() {
// COde to update UI.
}
});
Upvotes: 1
Reputation: 3771
You are attempting to modify UI components on a thread that is not the UI thread. Take a look at runOnUiThread
for updating UI components from non-UI threads.
Upvotes: 0
Reputation: 15701
looks you are trying to update the UI element from non UI thread.
should use Handler
or runOuUIThread
function of activities or Asynctask
as per your need
Upvotes: 2