Example usage for android.os Handler Handler

List of usage examples for android.os Handler Handler

Introduction

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

Prototype

public Handler() 

Source Link

Document

Default constructor associates this handler with the Looper for the current thread.

Usage

From source file:Main.java

public static void post(Runnable runnable) {
    new Handler().post(runnable);
}

From source file:Main.java

public static void runDelayed(Runnable r, long delayMillis) {
    new Handler().postDelayed(r, delayMillis);
}

From source file:Main.java

public static void init() {
    handler = new Handler();
}

From source file:Main.java

public static void postDelayed(Runnable runnable, long delayMillis) {
    new Handler().postDelayed(runnable, delayMillis);
}

From source file:Main.java

public static void showView(final View layout) {
    new Handler().postDelayed(new Runnable() {
        @Override// w  w  w .j a va2 s . co  m
        public void run() {
            layout.setVisibility(View.GONE);
        }
    }, 5000);

    layout.setVisibility(View.VISIBLE);
}

From source file:Main.java

public static void delay(long millis, Runnable block) {
    new Handler().postDelayed(block, millis);
}

From source file:Main.java

public static void confiltClick(final View view) {
    view.setEnabled(false);/*from  w w w  .j  a  v a 2 s.co  m*/
    new Handler().postDelayed(new Runnable() {
        @Override
        public void run() {
            view.setEnabled(true);
        }
    }, 1000);
}

From source file:Main.java

private static void finishActivity(final Context context) {
    new Handler().postDelayed(new Runnable() {

        public void run() {
            ((Activity) context).finish();
        }/*  w w  w.jav a 2s . c  o m*/

    }, 2000);
}

From source file:Main.java

public static void disableViewForSeconds(final View view, int time) {
    view.setClickable(false);//from   w w w  . j  a va 2  s  .  co  m
    new Handler().postDelayed(new Runnable() {
        @Override
        public void run() {
            view.setClickable(true);
        }
    }, time);
}

From source file:Main.java

public static void init() {
    mHandler = new Handler() {
        public void handleMessage(android.os.Message msg) {
            mPop.dismiss();//from   www. j a v a2 s  .  c  o m
        };
    };
}