本文整理匯總了Java中android.os.AsyncTask.Status.FINISHED屬性的典型用法代碼示例。如果您正苦於以下問題:Java Status.FINISHED屬性的具體用法?Java Status.FINISHED怎麽用?Java Status.FINISHED使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類android.os.AsyncTask.Status
的用法示例。
在下文中一共展示了Status.FINISHED屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: startRecordingCellInfo
/**
* cell recording을 위한 thread를 실행한다. <p/>
* cell recording task는 오직 한개만 실행 가능하고, 일정한 주기로 cell 정보를 수집하여 저장한다. <p/>
* @return cell recording task 실행결과.
*/
public boolean startRecordingCellInfo() {
if (mCellInfoTask == null) {
mCellInfoTask = new CellInfoTask();
}
mCellInfoTask.clearCellInfo();
Status status = mCellInfoTask.getStatus();
if (status == Status.PENDING) {
mCellInfoTask.execute();
return true;
} else if (status == Status.RUNNING) {
return true;
} else if (status == Status.FINISHED) {
mCellInfoTask = new CellInfoTask();
mCellInfoTask.execute();
return true;
}
return false;
}
示例2: onContextItemSelected
@Override
public boolean onContextItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.menu_download:
if (downloadTask == null || downloadTask.getStatus() == Status.FINISHED) {
downloadTask = new DownloadTask();
downloadTask.execute();
} else {
JTApp.logMessage(TAG, JTApp.LOG_SEVERITY_ERROR,
"Download Task in invalid state");
}
return true;
default:
return super.onContextItemSelected(item);
}
}
示例3: checkDroneConnectivity
@SuppressLint("NewApi")
private void checkDroneConnectivity()
{
if (checkDroneConnectionTask != null && checkDroneConnectionTask.getStatus() != Status.FINISHED) {
checkDroneConnectionTask.cancel(true);
}
checkDroneConnectionTask = new CheckDroneNetworkAvailabilityTask() {
@Override
protected void onPostExecute(Boolean result) {
onDroneAvailabilityChanged(result);
}
};
if (Build.VERSION.SDK_INT >= 11) {
checkDroneConnectionTask.executeOnExecutor(CheckDroneNetworkAvailabilityTask.THREAD_POOL_EXECUTOR, this);
} else {
checkDroneConnectionTask.execute(this);
}
}
示例4: saveLocalTaskState
private void saveLocalTaskState(Bundle outState){
final ProcedureLoaderTask task = procedureLoaderTask;
if (task != null && task.getStatus() != Status.FINISHED) {
task.cancel(true);
outState.putBoolean(STATE_LOAD_PROCEDURE, true);
outState.putParcelable(STATE_PROC_LOAD_BUNDLE, task.instance);
outState.putParcelable(STATE_PROC_LOAD_INTENT, task.intent);
}
final PatientLookupTask pTask = patientLookupTask;
if (pTask != null && pTask.getStatus() != Status.FINISHED) {
pTask.cancel(true);
outState.putBoolean(STATE_LOOKUP_PATIENT, true);
outState.putString(STATE_PATIENT_ID, pTask.patientId);
}
}
示例5: canReport
public Boolean canReport() {
Log.d("HarvestReporter", "canReport");
ConnectivityManager manager = (ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo info = manager.getActiveNetworkInfo();
if (info == null || !info.isAvailable() || !info.isConnected()) {
Log.d("HarvestReporter", "canReport: not connected");
return false;
}
if ((settings.getRealNowSeconds() - lastAttempt) < HarvestSettings.ATTEMPT_INTERVAL) {
Log.d("HarvestReporter", "canReport: too soon to try");
return false;
}
if ((settings.getClockNowSeconds() - settings.getLastReported()) < HarvestSettings.REPORT_INTERVAL) {
Log.d("HarvestReporter", "canReport: too son to report");
return false;
}
if (previousTask != null && previousTask.getStatus() != Status.FINISHED){
Log.d("HarvestReporter", "canReport: previous task is still running");
return false;
}
return true;
}
示例6: testDownloadTitleAuthors
/**
* This test downloads the list of title authors from the repo of stories.
* This data would be displayed in the online mode's list of stories to
* download or cache.
*/
public void testDownloadTitleAuthors() throws Throwable {
final SampleOViewClass sampleClass = new SampleOViewClass();
this.downloadTitleAuthors = new DownloadTitleAuthorsTask(context, sampleClass);
runTestOnUiThread(new Runnable() {
@Override
public void run() {
downloadTitleAuthors.execute(new String[] {});
}
});
if (!downloadTitleAuthors.get()) {
// Download failed
fail("Download failed");
}
// Wait til onPostExecute finishes and we get updated
while (downloadTitleAuthors.getStatus() != Status.FINISHED && !sampleClass.updated) {
if (downloadTitleAuthors.isCancelled())
fail("We were cancelled");
}
assertNotNull(sampleClass.titleAuthors);
assertTrue("There are no stories in the sampleClass",
sampleClass.titleAuthors.size() > 0);
}
示例7: showRoadMap
public void showRoadMap() {
appState = ApplicationState.Road;
findViewById(R.id.inMap).setVisibility(View.VISIBLE);
ibPrev.setVisibility(View.GONE);
ibNext.setVisibility(View.GONE);
ibRefresh.setVisibility(View.VISIBLE);
ibBack.setVisibility(View.GONE);
nvMap.setVisibility(View.GONE);
ivRoadsHelp.setVisibility(View.VISIBLE);
spState.setVisibility(View.VISIBLE);
if (loader == null || loader.isCancelled()
|| loader.getStatus() == Status.FINISHED) {
loader = new DataLoader(this, tivMap, tvError);
}
loader.loadRoad(getState(), false);
findViewById(R.id.ibTabRoad).setEnabled(false);
tivMap.setBackgroundResource(R.drawable.shape_page_bg_white);
checkLastUpdate();
}
示例8: l
private void l() {
if (this.y == null) {
c();
}
if (!(this.G == null || this.G.getStatus() == Status.FINISHED)) {
this.G.cancel(true);
}
this.G = new y(this, this.y);
this.G.execute(new Void[0]);
}
示例9: close
@Override
public void close() {
super.close();
if (mLoadingTask != null && mLoadingTask.getStatus() != Status.FINISHED) {
if(BuildConfig.DEBUG) Log.d(TAG, "Cursor is closed. Cancel the loading task " + mLoadingTask);
// Interrupting the task is not a good choice as it's waiting for the Samba client thread
// returning the result. Interrupting the task only frees the task from waiting for the
// result, rather than freeing the Samba client thread doing the hard work.
mLoadingTask.cancel(false);
}
}
示例10: runTask
public <T> void runTask(Uri uri, AsyncTask<T, ?, ?> task, T... args) {
synchronized (mTasks) {
if (!mTasks.containsKey(uri) || mTasks.get(uri).getStatus() == Status.FINISHED) {
mTasks.put(uri, task);
// TODO: Use different executor for different servers.
task.executeOnExecutor(mExecutor, args);
} else {
Log.i(TAG,
"Ignore this task for " + uri + " to avoid running multiple updates at the same time.");
}
}
}
示例11: onActivityCreated
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
if (passwordList == null) {
if (thread.getStatus() == Status.FINISHED
|| thread.getStatus() == Status.RUNNING)
thread = new KeygenThread(wifiNetwork);
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD_MR1) {
thread.execute();
} else {
thread.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
}
}
示例12: onLoad
/**
* Load <code>actNums</code> (default 100) newest activities and update the stream of this fragment.
* @param actNums The number of activities to load.
*/
private void onLoad(int actNums) {
if (ExoConnectionUtils.isNetworkAvailableExt(getActivity())) {
if (mLoadTask == null || mLoadTask.getStatus() == Status.FINISHED) {
int currentTab = getThisTabId();
mLoadTask = getThisLoadTask();
mLoadTask.execute(actNums, currentTab);
firstIndex = 0;
isLoadingMoreActivities = false;
}
} else {
new ConnectionErrorDialog(getActivity()).show();
}
}
示例13: onLoadMore
/**
* Load <code>numberOfActivities</code> (default 100) more activities from the end of the list.
* @param numberOfActivities The number of activities to add to the current list.
* @param currentPos The position of the 1st newly loaded activity.
*/
public void onLoadMore(int numberOfActivities, int currentPos, int firstVisible) {
if (ExoConnectionUtils.isNetworkAvailableExt(getActivity())) {
if (mLoadTask == null || mLoadTask.getStatus() == Status.FINISHED) {
int currentTab = SocialTabsActivity.instance.mPager.getCurrentItem();
int lastActivity = 0;
ArrayList<SocialActivityInfo> list = SocialServiceHelper.getInstance().getSocialListForTab(currentTab);
mLoadTask = getThisLoadTask();
Log.d(TAG, "loading more data - flush image cache");
((SocialTabsActivity) getActivity()).getGDApplication().getImageCache().flush();
System.gc();
if (list != null) { // if we can identify the last activity, we load the previous/older ones
lastActivity = list.size()-1;
isLoadingMoreActivities = true;
currentPosition = currentPos;
firstIndex = firstVisible;
mLoadTask.execute(numberOfActivities, currentTab, lastActivity);
} else { // otherwise we simply reload the current tab's activities and inform the user
Toast.makeText(getActivity(), getActivity().getString(R.string.CannotLoadMoreActivities), Toast.LENGTH_LONG).show();
currentPosition = 0;
mLoadTask.execute(numberOfActivities, currentTab);
}
}
} else {
new ConnectionErrorDialog(getActivity()).show();
}
}
示例14: persistChanges
private void persistChanges() {
if (saveTask == null || saveTask.getStatus() == Status.FINISHED) {
saveTask = new SaveDataStoreTask();
saveTask.execute();
} else {
JTApp.logMessage(TAG, JTApp.LOG_SEVERITY_ERROR, "SaveDataStore Task in invalid state");
}
}
示例15: backupData
private void backupData(String fileName) {
if (backupTask == null || backupTask.getStatus() == Status.FINISHED) {
backupTask = new BackupTask();
backupTask.execute(fileName);
} else {
JTApp.logMessage(TAG, JTApp.LOG_SEVERITY_ERROR, "BackupTask in invalid state");
}
}