Skip to content

Instantly share code, notes, and snippets.

@yishai-glide
Created April 19, 2015 13:31
Show Gist options
  • Save yishai-glide/1e8fe8021e679f8ca2ed to your computer and use it in GitHub Desktop.
Save yishai-glide/1e8fe8021e679f8ca2ed to your computer and use it in GitHub Desktop.
public class MyAsyncTask extends AsyncTask {
WeakReference<MyActivityInterface> mCaller;
public MyAsyncTask(MyActivityInterface caller) {
mCaller = caller;
}
// here comes code
public void onPostExecute(Object result) {
if(mCaller.get() != null) {
mCaller.doSomething();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment