Skip to content

Instantly share code, notes, and snippets.

@deveshmittal
Created March 19, 2015 11:28
Show Gist options
  • Select an option

  • Save deveshmittal/8ea70ffe2670024180eb to your computer and use it in GitHub Desktop.

Select an option

Save deveshmittal/8ea70ffe2670024180eb to your computer and use it in GitHub Desktop.
public void GenericAsyncTask<T> extends AsyncTask<Void, Void , T>{
public interface TaskCompletionDelegate<T>{
public void onTaskCompleted(T result)}
private Class<T> type;
private TaskCompletionDelegate<T> listener;
public GenericAsyncTask(Class<T> classType , TaskCompletionDelegate listener ){
this.type = classType;
this.listener = listener;
}
@Override
protected T doInBackground(Void... args){
return (T)MasterResponse.fetchResonse();
}
@Override
protected void onPostExecute(T result){
listener.onTaskCompleted(result);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment