Example usage for android.view ViewTreeObserver removeOnGlobalFocusChangeListener

List of usage examples for android.view ViewTreeObserver removeOnGlobalFocusChangeListener

Introduction

In this page you can find the example usage for android.view ViewTreeObserver removeOnGlobalFocusChangeListener.

Prototype

public void removeOnGlobalFocusChangeListener(OnGlobalFocusChangeListener victim) 

Source Link

Document

Remove a previously installed focus change callback.

Usage

From source file:eu.inmite.android.lib.validations.form.FormValidator.java

/**
 * stop previously started live validation by {@link #startLiveValidation(Object, android.view.View, eu.inmite.android.lib.validations.form.iface.IValidationCallback)}
 * @param target live validation is recognized by target object
 * @return true if there was live validation to stop
 *//*from  w  w  w . j av  a 2 s . co  m*/
public static boolean stopLiveValidation(final Object target) {
    if (sLiveValidations == null || !sLiveValidations.containsKey(target)) {
        return false;
    }
    final ViewGlobalFocusChangeListener removed = sLiveValidations.remove(target);
    final ViewTreeObserver treeObserver = removed.formContainer.getViewTreeObserver();
    if (treeObserver.isAlive()) {
        treeObserver.removeOnGlobalFocusChangeListener(removed);
        return true;
    }

    return false;
}