Created
March 19, 2015 11:28
-
-
Save deveshmittal/8ea70ffe2670024180eb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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