although answer is accepted, just adding another, real anonymous implementation. hope this help others.
your interface : you can implement this inside AsyncTask class.
public interface ImageLoaderListener{
void imageDownloaderCallBack(Bitmap bmp);
}
AsyncTask class Constructor :
// declare interface variable
private ImageLoaderListener listener;
private String link;
public ImageDownloader(String link, ImageLoaderListener listener){
this.link = link;
this.listener = listener;
}
onPostExecution :
@Override
protected void onPostExecute(Void result){
listener.imageDownloaderCallBack(bitmap);
// your code, i was returning bitmap
}
implementation in Activity class :
ImageDownloader imageDownloader = new ImageDownloader(url, new ImageLoaderListener(){
@Override
public void imageDownloaderCallBack(Bitmap bmp) {
// update Ui elements
}
});
imageDownloader.execute();
Also, you should remember that if any Ui elements need to be updated based on imageDownloaderCallBack
return values, you should write that code inside function itself.