Question: I am having a main class A, from which i create an object to class B extending Asynctask. Have set content view in A. Now in doInBackground of B, i want to update the textView of A, but its giving 

`Caused by: android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.` 

Exception. I tried declaring the setcontentview in B as well, but no use, can anyone please tell how to edit the textview of A in B??

Answer: 
You need to call `setText()` from the UI thread, so either from `onPreExecute()`, `onPostExecute()` or in `onProgressUpdate()`

You could also use a `runOnUiThread()` handler in `doInBackground()`, but that kind of defeats the purpose of using an AsyncTask.
override onProgressUpdate and call publishProgress in doInBackground