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


Java Status.PENDING屬性代碼示例

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


在下文中一共展示了Status.PENDING屬性的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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;
}
 
開發者ID:ddinsight,項目名稱:dd-collector,代碼行數:26,代碼來源:AirplugAnalyticTracker.java

示例2: showUpdateDialog

private void showUpdateDialog() {
    if (updateDialog == null || !updateDialog.isShowing()) {
        if (loader != null
                && (loader.isCancelled() || loader.getStatus() == Status.PENDING)
                && Utils.isConnected(context)) {
            AlertDialog.Builder builder = new AlertDialog.Builder(this);
            updateDialog = builder
                    .setMessage(getString(R.string.msg_updatemap))
                    .setPositiveButton(getString(R.string.msg_yes),
                            MainActivity.this)
                    .setNegativeButton(getString(R.string.msg_no),
                            MainActivity.this).show();
        } else {
            Log.wtf(TAG, "WTF!");
        }
    }
}
 
開發者ID:mohsenoid,項目名稱:tehran_traffic_map,代碼行數:17,代碼來源:MainActivity.java

示例3: startCountDown

public void startCountDown() {
    if (mCountDownTask == null) {
        mCanStartCountDown = true;
    } else if (mCountDownTask.getStatus() == Status.PENDING) {
        mCountDownTask.execute();
    }
}
 
開發者ID:CmoaToto,項目名稱:CmoaQuiz,代碼行數:7,代碼來源:QuestionFragment.java

示例4: displayImage

private void displayImage(AbsListView listView) {
	int firstPos = listView.getFirstVisiblePosition();
	int lastPos = listView.getLastVisiblePosition();
	int totalCount = lastPos - firstPos + 1;
	
	Log.v(TAG, "滾動停止加載圖片..");
	for (int i = 0; i < totalCount; i++) {
		View view = listView.getChildAt(i);
		Object tag = view.getTag();
	    if (!(tag instanceof StatusHolder)) {
	    	continue;
	    }
	    
	    StatusHolder holder = (StatusHolder)view.getTag();
	    ImageLoad4ThumbnailTask thumbnailTask = holder.thumbnailTask;
	    if (thumbnailTask != null 
	    	&& thumbnailTask.isCancelled() == false
	    	&& thumbnailTask.getStatus() == Status.PENDING) {
	    	thumbnailTask.execute();
	    }
	    
	    QueryResponseCountTask responseCountTask  = holder.responseCountTask;
	    if (responseCountTask != null
	    	&& responseCountTask.isCancelled() == false
	    	&& responseCountTask.getStatus() == Status.PENDING) {
	    	responseCountTask.execute();
	    }
	}
}
 
開發者ID:cattong,項目名稱:YiBo,代碼行數:29,代碼來源:StatusScrollListener.java

示例5: refreshAction

private void refreshAction() {
    Glide.get(getContext()).clearMemory();
    preferences.removeCache(getDateFromArguments());
    if (this.loadTask == null
            || this.loadTask.getStatus() != Status.PENDING) {
        this.loadTask = new GetStripUrl(getStripURIlListener, preferences,
                getDateFromArguments(), progress);
    }
    this.loadTask.execute();
}
 
開發者ID:smarek,項目名稱:Simple-Dilbert,代碼行數:10,代碼來源:DilbertFragment.java

示例6: connectChatService

/**
 * Connects to the Chat Service
 */

private void connectChatService() {

    //If there already is a pending connect task, remove it since we have a newer one
    if (mConnectRunnable != null) {
        mHandler.removeCallbacks(mConnectRunnable);
    }

    if (mMessageConsumer == null) {
        Logger.e(TAG, "should not happen");
    } else {

        if (isLoggedIn() && !mMessageConsumer.isRunning()) {

            mConnectRunnable = new Runnable() {

                @Override
                public void run() {

                    if (!isLoggedIn()
                            || !DeviceInfo.INSTANCE
                            .isNetworkConnected()) {

                        //If there is no internet connection or we are not logged in, we need not attempt to connect
                        mConnectRunnable = null;
                        return;
                    }

                    mQueueName = generateQueueNameFromUserId(UserInfo.INSTANCE.getId());

                    if (mConnectTask == null) {
                        mConnectTask = new ConnectToChatAsyncTask();
                        mConnectTask.execute(USERNAME, PASSWORD, mQueueName, UserInfo.INSTANCE
                                .getId());
                    } else {
                        final Status connectingStatus = mConnectTask
                                .getStatus();

                        if (connectingStatus != Status.RUNNING) {

                            // We are not already attempting to connect, let's try connecting
                            if (connectingStatus == Status.PENDING) {
                                //Cancel a pending task
                                mConnectTask.cancel(false);
                            }

                            mConnectTask = new ConnectToChatAsyncTask();
                            mConnectTask.execute(USERNAME, PASSWORD, mQueueName, UserInfo.INSTANCE
                                    .getId());
                        }
                    }
                    mConnectRunnable = null;

                }

            };

            mHandler.postDelayed(mConnectRunnable, mCurrentConnectMultiplier
                    * CONNECT_BACKOFF_INTERVAL * 1000);
            mCurrentConnectMultiplier = (++mCurrentConnectMultiplier > MAX_CONNECT_MULTIPLIER) ? MAX_CONNECT_MULTIPLIER
                    : mCurrentConnectMultiplier;
        }
    }

}
 
開發者ID:yeloapp,項目名稱:yelo-android,代碼行數:68,代碼來源:ChatService.java

示例7: connectChatService

/**
 * Connects to the Chat Service
 */
private void connectChatService() {

    //If there already is a pending connect task, remove it since we have a newer one
    if (mConnectRunnable != null) {
        mHandler.removeCallbacks(mConnectRunnable);
    }
    if (isLoggedIn() && !mMessageConsumer.isRunning()) {

        mConnectRunnable = new Runnable() {

            @Override
            public void run() {

                if (!isLoggedIn()
                        || !DeviceInfo.INSTANCE
                        .isNetworkConnected()) {

                    //If there is no internet connection or we are not logged in, we need not attempt to connect
                    mConnectRunnable = null;
                    return;
                }

                mQueueName = generateQueueNameFromUserEmailAndDeviceId(UserInfo.INSTANCE
                                                                               .getEmail(),
                                                                       UserInfo.INSTANCE
                                                                               .getDeviceId()
                );

                if (mConnectTask == null) {
                    mConnectTask = new ConnectToChatAsyncTask();
                    mConnectTask.execute(USERNAME, PASSWORD, mQueueName, UserInfo.INSTANCE
                            .getId());
                } else {
                    final Status connectingStatus = mConnectTask
                            .getStatus();

                    if (connectingStatus != Status.RUNNING) {

                        // We are not already attempting to connect, let's try connecting
                        if (connectingStatus == Status.PENDING) {
                            //Cancel a pending task
                            mConnectTask.cancel(false);
                        }

                        mConnectTask = new ConnectToChatAsyncTask();
                        mConnectTask.execute(USERNAME, PASSWORD, mQueueName, UserInfo.INSTANCE
                                .getId());
                    }
                }
                mConnectRunnable = null;

            }

        };

        mHandler.postDelayed(mConnectRunnable, mCurrentConnectMultiplier
                * CONNECT_BACKOFF_INTERVAL * 1000);
        mCurrentConnectMultiplier = (++mCurrentConnectMultiplier > MAX_CONNECT_MULTIPLIER) ? MAX_CONNECT_MULTIPLIER
                : mCurrentConnectMultiplier;
    }

}
 
開發者ID:barterli,項目名稱:barterli_android,代碼行數:65,代碼來源:ChatService.java


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