Example usage for android.os HandlerThread quitSafely

List of usage examples for android.os HandlerThread quitSafely

Introduction

In this page you can find the example usage for android.os HandlerThread quitSafely.

Prototype

public boolean quitSafely() 

Source Link

Document

Quits the handler thread's looper safely.

Usage

From source file:Main.java

@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
public static void quitSafely(HandlerThread handlerThread) {
    if (handlerThread == null) {
        return;//from   w ww.ja v  a2s.c  om
    }

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
        handlerThread.quitSafely();
    } else {
        handlerThread.quit();
    }
}