Last active
August 29, 2015 14:19
-
-
Save RobGThai/cc222a41ab699e7eff3c to your computer and use it in GitHub Desktop.
Revisions
-
RobGThai revised this gist
Apr 16, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -7,7 +7,7 @@ public abstract class NamedAsyncTask<Params, Progress, Result> extends AsyncTask private void setNewThreadName(String name) { oldName = Thread.currentThread().getName(); if(!TextUtils.isEmpty(name)) Thread.currentThread().setName(name); } protected abstract String getThreadName(); -
RobGThai renamed this gist
Apr 16, 2015 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
RobGThai created this gist
Apr 16, 2015 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,26 @@ package common.asynctask; import android.os.AsyncTask; public abstract class NamedAsyncTask<Params, Progress, Result> extends AsyncTask<Params, Progress, Result> { private String oldName; private void setNewThreadName(String name) { oldName = Thread.currentThread().getName(); Thread.currentThread().setName(name); } protected abstract String getThreadName(); @Override protected void onPreExecute() { super.onPreExecute(); setNewThreadName(getThreadName()); } @Override protected void onCancelled() { Thread.currentThread().setName(oldName); super.onCancelled(); } }