Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
/*
 * Copyright (c) 2014-present, Facebook, Inc.
 * All rights reserved.
 *
 * This source code is licensed under the BSD-style license found in the
 * LICENSE file in the root directory of this source tree. An additional grant
 * of patent rights can be found in the PATENTS file in the same directory.
 */

import android.os.Handler;
import android.os.Looper;

public class Main {
    /**
     * Checks whether the current thread is the same thread that the {@link Handler} is associated
     * with.
     * @return true if the current thread is the same thread that the {@link Handler} is associated
     * with; otherwise false.
     */
    public static boolean checkThreadAccess(Handler handler) {
        return Looper.myLooper() == handler.getLooper();
    }
}