is In Main Thread - Android Android OS

Android examples for Android OS:Thread

Description

is In Main Thread

Demo Code


//package com.java2s;

import android.os.Looper;

public class Main {
    public static boolean isInMainThread() {
        Looper myLooper = Looper.myLooper();
        Looper mainLooper = Looper.getMainLooper();
        return myLooper == mainLooper;
    }/*from  w  w w .  j a v a 2s .c o  m*/
}

Related Tutorials