Example usage for com.facebook.react.bridge UiThreadUtil assertOnUiThread

List of usage examples for com.facebook.react.bridge UiThreadUtil assertOnUiThread

Introduction

In this page you can find the example usage for com.facebook.react.bridge UiThreadUtil assertOnUiThread.

Prototype

public static void assertOnUiThread() 

Source Link

Document

Throws an AssertionException if the current thread is not the UI thread.

Usage

From source file:org.jitsi.meet.sdk.ListenerUtils.java

License:Apache License

/**
 * Helper companion for {@link ListenerUtils#runListenerMethod} which runs
 * in the UI thread.// www  . j  a  v a2s.  c o  m
 */
private static void runListenerMethodOnUiThread(Object listener, Map<String, Method> listenerMethods,
        String eventName, ReadableMap eventData) {
    UiThreadUtil.assertOnUiThread();

    Method method = listenerMethods.get(eventName);
    if (method != null) {
        try {
            method.invoke(listener, toHashMap(eventData));
        } catch (IllegalAccessException e) {
            throw new RuntimeException(e);
        } catch (InvocationTargetException e) {
            throw new RuntimeException(e);
        }
    }
}