Creates new Handler with the same Looper as the original handler. - Android java.lang

Android examples for java.lang:Thread

Description

Creates new Handler with the same Looper as the original handler.

Demo Code


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

public class Main {
    /**/*from  ww w. j  a v  a  2 s.c  o  m*/
     * Creates new {@link Handler} with the same {@link Looper} as the original handler.
     *
     * @param original original handler, can not be null
     * @param callback message handling callback, may be null
     * @return new instance
     */
    public static Handler newHandler(Handler original,
            Handler.Callback callback) {
        return new Handler(original.getLooper(), callback);
    }
}

Related Tutorials