android - How to use Context to access/manipulate another class/activity -
i want create generic asyncetask class activities use/share downloading content url. reason, don't want onpostexecute other send content method in activity invoked asynctask class. i know need create constructor sets context of activity invoked asynctask , what, how use context send the activity corresponding context. i've seen no tutorials show how use context in manner. lets have: public class loginactivity { public int activitymember; public void handlebuttonclick(void){ downloadfromurl task = new downloadfromurl(this); task.execute(url); } public void handleloginresult(int x){ activitymember = x; } } now in separate java file have: private class downloadfromurl extends asynctask<list<namevaluepair>, long, jsonobject> { context context; public void downloadfromurl (context context){ this.context = context; } @override protected void onpostexecute(jsonobject json) { ...