public final class SimpleTask extends AsyncTask<String,Integer,Void>
SimpleTask.with(this).execute(item1, item2, ..., itemN);
Modifier and Type | Class and Description |
---|---|
static interface |
SimpleTask.TaskExecutor
An interface for the object that actually runs the task.
|
AsyncTask.Status
SERIAL_EXECUTOR, THREAD_POOL_EXECUTOR
Modifier and Type | Method and Description |
---|---|
protected Void |
doInBackground(String... items)
Runs the task in the background on the given set of items.
|
long |
getElapsedTime()
Returns the amount of time in MS that elapsed while this SimpleTask was running.
|
long |
getEndTime()
Returns the MS time at which this task finished running, as a long integer of MS
since the epoch (Jan 1 1970 12:00:00am).
|
long |
getStartTime()
Returns the MS time at which this task began running, as a long integer of MS
since the epoch (Jan 1 1970 12:00:00am).
|
protected void |
onPostExecute(Void result)
Called after the task ends.
|
protected void |
onPreExecute()
Called before the task begins.
|
protected void |
onProgressUpdate(Integer... progress)
Called when the task reports that progress has been made via its publishProgress method.
|
void |
publishProgress(int progress)
Your task code can call this to indicate that progress has been made.
|
static SimpleTask |
with(SimpleActivity context)
Returns a singleton SimpleTask instance bound to the given context.
|
static SimpleTask |
with(SimpleFragment context)
Returns a singleton SimpleTask instance bound to the given context.
|
static SimpleTask |
with(SimpleTask.TaskExecutor context)
Returns a singleton SimpleTask instance bound to the given context.
|
cancel, execute, execute, executeOnExecutor, get, get, getStatus, isCancelled, onCancelled, onCancelled, publishProgress
public static SimpleTask with(SimpleActivity context)
public static SimpleTask with(SimpleFragment context)
public static SimpleTask with(SimpleTask.TaskExecutor context)
protected Void doInBackground(String... items)
doInBackground
in class AsyncTask<String,Integer,Void>
public long getElapsedTime()
public long getEndTime()
public long getStartTime()
protected void onPreExecute()
onPreExecute
in class AsyncTask<String,Integer,Void>
protected void onProgressUpdate(Integer... progress)
onProgressUpdate
in class AsyncTask<String,Integer,Void>
protected void onPostExecute(Void result)
onPostExecute
in class AsyncTask<String,Integer,Void>
public void publishProgress(int progress)