本文整理匯總了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;
}
示例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!");
}
}
}
示例3: startCountDown
public void startCountDown() {
if (mCountDownTask == null) {
mCanStartCountDown = true;
} else if (mCountDownTask.getStatus() == Status.PENDING) {
mCountDownTask.execute();
}
}
示例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();
}
}
}
示例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();
}
示例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;
}
}
}
示例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;
}
}