当前位置: 首页>>代码示例>>Java>>正文


Java Looper.quitSafely方法代码示例

本文整理汇总了Java中android.os.Looper.quitSafely方法的典型用法代码示例。如果您正苦于以下问题:Java Looper.quitSafely方法的具体用法?Java Looper.quitSafely怎么用?Java Looper.quitSafely使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.os.Looper的用法示例。


在下文中一共展示了Looper.quitSafely方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: quitSafely

import android.os.Looper; //导入方法依赖的package包/类
/**
 * Quits the handler thread's looper safely.
 * <p>
 * Causes the handler thread's looper to terminate as soon as all remaining messages
 * in the message queue that are already due to be delivered have been handled.
 * Pending delayed messages with due times in the future will not be delivered.
 * </p><p>
 * Any attempt to post messages to the queue after the looper is asked to quit will fail.
 * For example, the {@link Handler#sendMessage(Message)} method will return false.
 * </p><p>
 * If the thread has not been started or has finished (that is if
 * {@link #getLooper} returns null), then false is returned.
 * Otherwise the looper is asked to quit and true is returned.
 * </p>
 *
 * @return True if the looper looper has been asked to quit or false if the
 * thread had not yet started running.
 */
public boolean quitSafely() {
    Looper looper = getLooper();
    if (looper != null) {
        looper.quitSafely();
        return true;
    }
    return false;
}
 
开发者ID:m2049r,项目名称:xmrwallet,代码行数:27,代码来源:MoneroHandlerThread.java


注:本文中的android.os.Looper.quitSafely方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。