當前位置: 首頁>>代碼示例>>Java>>正文


Java Status類代碼示例

本文整理匯總了Java中android.os.AsyncTask.Status的典型用法代碼示例。如果您正苦於以下問題:Java Status類的具體用法?Java Status怎麽用?Java Status使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Status類屬於android.os.AsyncTask包,在下文中一共展示了Status類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: startRecordingCellInfo

import android.os.AsyncTask.Status; //導入依賴的package包/類
/**
 * 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;
}
 
開發者ID:ddinsight,項目名稱:dd-collector,代碼行數:27,代碼來源:AirplugAnalyticTracker.java

示例2: onContextItemSelected

import android.os.AsyncTask.Status; //導入依賴的package包/類
@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);
    }
}
 
開發者ID:jabstone,項目名稱:JABtalk,代碼行數:17,代碼來源:BrowserActivity.java

示例3: restoreProgressDialog

import android.os.AsyncTask.Status; //導入依賴的package包/類
private void restoreProgressDialog() {
    if (restoreTask != null && restoreTask.getStatus() == AsyncTask.Status.RUNNING) {
        progressDialog.setMessage(getString(R.string.dialog_message_restoring));
        progressDialog.show();
    }

    if (saveTask != null && saveTask.getStatus() == AsyncTask.Status.RUNNING) {
        progressDialog.setMessage(getString(R.string.dialog_message_saving));
        progressDialog.show();
    }

    if (backupTask != null && backupTask.getStatus() == AsyncTask.Status.RUNNING) {
        progressDialog.setMessage(getString(R.string.dialog_message_backup));
        progressDialog.show();
    }
}
 
開發者ID:jabstone,項目名稱:JABtalk,代碼行數:17,代碼來源:ManageActivity.java

示例4: lookupPatient

import android.os.AsyncTask.Status; //導入依賴的package包/類
private void lookupPatient(String patientId) {
	logEvent(EventType.ENCOUNTER_LOOKUP_PATIENT_START, patientId);
	if (lookupProgress == null) {
		lookupProgress = new ProgressDialog(this);
		lookupProgress.setMessage("Looking up patient \""+patientId +"\""); // TODO i18n
    	lookupProgress.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    	if(!isFinishing())
    		lookupProgress.show();
    		
		if(patientLookupTask == null || 
				patientLookupTask.getStatus() == Status.FINISHED){
			patientLookupTask = new PatientLookupTask(this);
			patientLookupTask.setPatientLookupListener(this);
			patientLookupTask.execute(patientId);
		}
	}
}
 
開發者ID:SahilArora92,項目名稱:vit-04,代碼行數:18,代碼來源:ProcedureRunner.java

示例5: saveLocalTaskState

import android.os.AsyncTask.Status; //導入依賴的package包/類
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);
     }
 }
 
開發者ID:SahilArora92,項目名稱:vit-04,代碼行數:17,代碼來源:ProcedureRunner.java

示例6: saveLocalTaskState

import android.os.AsyncTask.Status; //導入依賴的package包/類
private void saveLocalTaskState(Bundle outState){
	final CheckCredentialsTask task = mCredentialsTask;
    if (task != null && task.getStatus() != Status.FINISHED) {
    	task.cancel(true);
    	outState.putBoolean(STATE_CHECK_CREDENTIALS, true);
    }
	final MDSSyncTask mTask = mSyncTask;
    if (mTask != null && mTask.getStatus() != Status.FINISHED) {
    	mTask.cancel(true);
    	outState.putBoolean(STATE_MDS_SYNC, true);
    }
	final ResetDatabaseTask rTask = mResetDatabaseTask;
    if (rTask != null && rTask.getStatus() != Status.FINISHED) {
    	rTask.cancel(true);
    	outState.putBoolean(STATE_RESET_DB, true);
    }
}
 
開發者ID:SahilArora92,項目名稱:vit-04,代碼行數:18,代碼來源:Moca.java

示例7: getDataSources

import android.os.AsyncTask.Status; //導入依賴的package包/類
public static void getDataSources(OnDataSourceResultListener listener,
		boolean force) {
	if (mDownloadTask == null
			|| mDownloadTask.getStatus() != Status.FINISHED || force) {
		mCurrentListeners.add(listener);

		if (mDownloadTask == null
				|| mDownloadTask.getStatus() == Status.FINISHED) {
			mDownloadTask = new DownloadTask();
			mDownloadTask.execute((Void) null);
		}
	} else {
		listener.onDataSourceResult(new ArrayList<PluginDownloadHolder>(
				mDownloadableDataSources));
	}
}
 
開發者ID:52North,項目名稱:geoar-app,代碼行數:17,代碼來源:PluginDownloader.java

示例8: onBackPressed

import android.os.AsyncTask.Status; //導入依賴的package包/類
@Override
public void onBackPressed() {
    if (mFlashFirmwareTask != null && mFlashFirmwareTask.getStatus().equals(Status.RUNNING)) {
        if (mDoubleBackToExitPressedOnce) {
            super.onBackPressed();
            return;
        }
        this.mDoubleBackToExitPressedOnce = true;
        Toast.makeText(this, "Please click BACK again to cancel flashing and exit", Toast.LENGTH_SHORT).show();
        new Handler().postDelayed(new Runnable() {

            @Override
            public void run() {
                mDoubleBackToExitPressedOnce = false;

            }
        }, 2000);
    } else {
        super.onBackPressed();
    }
}
 
開發者ID:bitcraze,項目名稱:crazyflie-android-client,代碼行數:22,代碼來源:BootloaderActivity.java

示例9: canReport

import android.os.AsyncTask.Status; //導入依賴的package包/類
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;
}
 
開發者ID:tchx84,項目名稱:analytics-client,代碼行數:27,代碼來源:HarvestReporter.java

示例10: handleTaskStatusChange

import android.os.AsyncTask.Status; //導入依賴的package包/類
public void handleTaskStatusChange(Uri task, org.sana.api.task.Status status, String now, ContentValues values){
    if(now == null) now = timeStamp();
    if(values == null)
        values = new ContentValues();
    Log.i(TAG, "Updating status: " + now + " --> " + status + " --> " + values.size() + " --> " + task);

    // update in db
    values.put(Tasks.Contract.STATUS, status.toString());
    values.put(Tasks.Contract.MODIFIED, now);

    // Convert to a Bundle so that we can pass it
    Log.d(TAG, "FORM data");
    Bundle form = new Bundle();
    form.putString(Tasks.Contract.STATUS,String.valueOf(status.code));
    form.putString(Tasks.Contract.MODIFIED,now);
    getContentResolver().update(task,values,null,null);

    // send to sync
    Intent intent = new Intent(Intents.ACTION_UPDATE,task);
    intent.putExtra("form", form);
    startService(intent);
}
 
開發者ID:SanaMobile,項目名稱:sana.mobile,代碼行數:23,代碼來源:MainActivity.java

示例11: markTaskStatusInProgress

import android.os.AsyncTask.Status; //導入依賴的package包/類
public void markTaskStatusInProgress(Uri task){
    Log.i(TAG, "markStatusInProgress(): " + task);
    org.sana.api.task.Status status = org.sana.api.task.Status.IN_PROGRESS;
    String now = timeStamp();
    ContentValues values = new ContentValues();
    values.put(Tasks.Contract.STATUS, "In Progress");
    values.put(Tasks.Contract.MODIFIED, now);
    values.put(Tasks.Contract.STARTED, now);
    getContentResolver().update(task,values,null,null);

    Bundle form = new Bundle();
    form.putString(Tasks.Contract.STATUS, "In Progress");
    form.putString(Tasks.Contract.MODIFIED,now);
    form.putString(Tasks.Contract.STARTED,now);

    // send to sync
    Intent intent = new Intent(Intents.ACTION_UPDATE,task);
    intent.putExtra("form", form);
    startService(intent);
}
 
開發者ID:SanaMobile,項目名稱:sana.mobile,代碼行數:21,代碼來源:MainActivity.java

示例12: markTaskStatusCompleted

import android.os.AsyncTask.Status; //導入依賴的package包/類
public void markTaskStatusCompleted(Uri task, Uri encounter){
    Log.i(TAG, "markStatusCompleted(): " + task);
    org.sana.api.task.Status status = org.sana.api.task.Status.COMPLETED;
    String now = timeStamp();
    String uuid = ModelWrapper.getUuid(encounter,getContentResolver());
    ContentValues values = new ContentValues();
    values.put(Tasks.Contract.STATUS, status.toString());
    values.put(Tasks.Contract.COMPLETED, now);
    values.put(EncounterTasks.Contract.ENCOUNTER, uuid);
    values.put(Tasks.Contract.MODIFIED, now);

    Bundle form = new Bundle();
    form.putString(Tasks.Contract.STATUS, status.toString());
    form.putString(Tasks.Contract.MODIFIED,now);
    form.putString(Tasks.Contract.COMPLETED,now);
    form.putString(EncounterTasks.Contract.ENCOUNTER, uuid);

    // send to sync
    Intent intent = new Intent(Intents.ACTION_UPDATE,task);
    intent.putExtra("form", form);
    startService(intent);
}
 
開發者ID:SanaMobile,項目名稱:sana.mobile,代碼行數:23,代碼來源:MainActivity.java

示例13: checkDroneConnectivity

import android.os.AsyncTask.Status; //導入依賴的package包/類
@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);
        }
}
 
開發者ID:fblandroidhackathon,項目名稱:persontracker,代碼行數:23,代碼來源:DashboardActivity.java

示例14: inverseTask

import android.os.AsyncTask.Status; //導入依賴的package包/類
/**
 * Permet de changer l'ordre de chargement des pages
 * @param targetPageNumber
 */
private void inverseTask(int targetPageNumber)
{
	// Si une t�che est en cours
	if (preLoadingPostsAsyncTask != null && preLoadingPostsAsyncTask.getStatus() == Status.RUNNING)
	{
		// si la page pr�c�dente n'est en cours de chargement
		if (preLoadingPostsAsyncTask.getPageNumber() != targetPageNumber)
		{
			// Sinon on force le chargement de la page pr�c�dente
			int interruptedPageNumber = preLoadingPostsAsyncTask.getPageNumber();
			preLoadingPostsAsyncTask.cancel(true);
			preLoadingPostsAsyncTask = new PreLoadingPostsAsyncTask(PostsActivity.this, interruptedPageNumber);
			preLoadingPostsAsyncTask.execute(targetPageNumber, topic);
		}
	}
}
 
開發者ID:Draluy,項目名稱:HFRFirefoxOS,代碼行數:21,代碼來源:PostsActivity.java

示例15: testDownloadTitleAuthors

import android.os.AsyncTask.Status; //導入依賴的package包/類
/**
 * 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);
}
 
開發者ID:Team-CMPUT301F13T12,項目名稱:301-Project,代碼行數:31,代碼來源:DownloadTasksTestCases.java


注:本文中的android.os.AsyncTask.Status類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。