Java Code Examples for android.os.AsyncTask#Status

The following examples show how to use android.os.AsyncTask#Status . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ProcessFragment.java    From PowerFileExplorer with GNU General Public License v3.0 5 votes vote down vote up
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
	AsyncTask.Status status;
	synchronized (searchTask) {
		if ((status = searchTask.getStatus()) == AsyncTask.Status.RUNNING
			|| status == AsyncTask.Status.PENDING) {
			searchTask.cancel(true);
		}
		searchTask = new SearchFileNameTask();
		searchTask.execute(position);
	}
}
 
Example 2
Source File: PreventFragment.java    From prevent with Do What The F*ck You Want To Public License 5 votes vote down vote up
public void startTaskIfNeeded() {
    AsyncTask.Status status = mTask.getStatus();
    if (status == AsyncTask.Status.PENDING) {
        mTask.execute();
    } else if (mTask.dialog != null) {
        mTask.dialog.show();
    }
}
 
Example 3
Source File: CatalogNetworkFragment.java    From Ouroboros with GNU General Public License v3.0 5 votes vote down vote up
public AsyncTask.Status getStatus(){
    if (insertCatalogIntoDatabaseTask != null){
        return insertCatalogIntoDatabaseTask.getStatus();
    } else {
        return null;
    }
}
 
Example 4
Source File: UpdateActivity.java    From commcare-android with Apache License 2.0 5 votes vote down vote up
private void setUiStateFromTaskStatus(AsyncTask.Status taskStatus) {
    switch (taskStatus) {
        case RUNNING:
            uiController.downloadingUiState();
            break;
        case PENDING:
            break;
        case FINISHED:
            uiController.errorUiState();
            break;
        default:
            uiController.errorUiState();
    }
}
 
Example 5
Source File: AsyncTaskAssert.java    From assertj-android with Apache License 2.0 5 votes vote down vote up
public AsyncTaskAssert hasStatus(AsyncTask.Status status) {
  isNotNull();
  AsyncTask.Status actualStatus = actual.getStatus();
  assertThat(actualStatus) //
      .overridingErrorMessage("Expected status <%s> but was <%s>.", status, actualStatus) //
      .isEqualTo(status);
  return this;
}