title: How to create reusable AsyncTasks in android?
body: <p>I have an application in android, where I am accessing couple of REST webservices. I am using AsyncTasks to access these and do some UI changes afterwords. I would like to use some of these calls in different activities. However, according to all tutorials I've read, AsyncTasks are used as internal classes in the activities (which makes sense, because they are changing the views in those activities). But how can I solve the reusability of those AsyncTasks? Even more, let's say I want to do some AsyncTasks calls upon location change. I have a LocationListener (which is a single external class) and I would like to do the API call inside of the onLocationChange() method. But I cannot access the views I would like to, because I am not in the activity class. Does anybody have a nice solution or idea how to do the architecture of the classes? Thank you.</p>