Call activity methods

To run method in parent activity from onPostExecute of AsyncTask, include the activity in the constructor. Solution found in stackoverflow.

public class ConverterClass extends Activity
new AsyncNetworkConnection(this);
public void doPostAsyncWork() {

public class AsyncNetworkConnection extends AsyncTask
ConverterClass converterActivity;
//constructor used by converter
public AsyncNetworkConnection(ConverterClass convAct) {
protected void onPostExecute(String result) {

To run method in parent activity from a fragment.



This entry was posted in Android. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *