Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import android.content.Context;
import android.os.Handler;

public class Main {
    /**
     * Run a some task on the UI thread.
     *
     * @param context The context
     * @param r       The runnable object that will be ran on the UI thread.
     */
    public static void runOnUiThread(Context context, Runnable r) {
        Handler handler = new Handler(context.getMainLooper());
        handler.post(r);
    }
}