The value returned only can be used on the postexecute method?
When I call the doInBackground method I get the source code (String) of a webpage. I want return that source code to my main activity because there I classify the information within the source code. But I’m thinking I can’t do that.. can I?
From the postexecute, could I return it?
In the
onPostExecutemethod, you could assign it to a member variable on your activity, or call some other method with it as an argument.Update per comment: You can declare the subclass of
AsyncTaskdeclared in another file, but you will not be able to manipulate member variables of the enclosing activity directly. You can, however, define interface to glue together your activity and theAsyncTaskdefined elsewhere, and pass in a reference to activity to theAsyncTaskin the constructor.