本文整理汇总了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;
}
}