Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private CustomTask mTask;
- @Override
- public void onActivityCreated(Bundle savedInstanceState)
- {
- super.onActivityCreated(savedInstanceState);
- if(this.mTask == null)
- {
- this.mTask = new CustomTask ()
- {
- @Override
- protected void onPostExecute(Response result)
- {
- //Your stuff
- Fragment.this.mTask = null;
- }
- @Override
- protected void onCancelled()
- {
- Fragment.this.mTask = null;
- }
- };
- this.mTask.ExecuteCompat();
- }
- }
- @Override
- public void onDestroyView()
- {
- if (this.mTask != null && this.mTask.getStatus() != AsyncTask.Status.FINISHED)
- this.mTask.cancel(true);
- super.onDestroy();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement