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: 
If the text update has to do with progress information, then you could use `publishProgress()`/`onProgressUpdate()` for that.

If it's not a progress update in a wider sense then I'm with Raghav -- you should consider another approach then.
doInBackground is work thread. You have handle View in UI thread. please do it in `onPreExecute()`, `onPostExecute()` or `onProgressUpdate`. All these are working in UI Thread.

Of course you can pass Integer to `onProgressUpdate`. please notice the second paramters: `AysncTask<Void, Integer, VOid>,` the second parameter means the `onProgressUpdate` parameter type