Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.os.Looper;

public class Main {

    public static void checkMainThread() {
        boolean error = false;
        if (Looper.myLooper() == null || Looper.getMainLooper() != Looper.myLooper()) {
            error = true;
        }

        if (error == true) {
            throw new RuntimeException("Must be in UI thread!");
        }
    }
}