registers the single thread-safe native activity status listener . this handles the case where the caller is not on the main thread . note that this is used by a leaky singleton object from the native side , hence lifecycle management is greatly simplified . concode_field_sep int STARTED concode_elem_sep int CREATED concode_elem_sep Activity sActivity concode_elem_sep int DESTROYED concode_elem_sep int PAUSED concode_elem_sep int sActivityState concode_elem_sep int STOPPED concode_elem_sep int RESUMED concode_elem_sep ObserverList<StateListener> sStateListeners concode_field_sep boolean isPaused concode_elem_sep Activity getActivity concode_elem_sep int getState concode_elem_sep void registerStateListener concode_elem_sep void onStateChange concode_elem_sep void nativeOnActivityStateChange concode_elem_sep void unregisterStateListener concode_elem_sep void onActivityStateChange
void function ( ) { ThreadUtils . runOnUiThread ( new Runnable ( ) { @ Override public void run ( ) { sStateListeners . addObserver ( new StateListener ( ) { @ Override public void onActivityStateChange ( int arg0 ) { nativeOnActivityStateChange ( arg0 ) ; } } ) ; } } ) ; }