remove Global Layout Listener - Android User Interface

Android examples for User Interface:Layout

Description

remove Global Layout Listener

Demo Code


//package com.java2s;
import android.os.Build;
import android.view.ViewTreeObserver;

public class Main {
    public static void removeGlobalLayoutListener(
            ViewTreeObserver observer,/*from   ww w.  ja va  2  s.  com*/
            ViewTreeObserver.OnGlobalLayoutListener listener) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
            observer.removeOnGlobalLayoutListener(listener);
        } else {
            //noinspection deprecation
            observer.removeGlobalOnLayoutListener(listener);
        }
    }
}

Related Tutorials