Getting NullPointerException at onFilterTouchEventForSecurity

I am not able to reproduce it but there are several things you can try:

If possible try adding android:filterTouchesWhenObscured=false as pellucide suggested from the docs:

Specifies whether to filter touches when the view’s window is obscured
by another visible window. When set to true, the view will not receive
touches whenever a toast, dialog or other window appears above the
view’s window. Refer to the View security documentation for more
details.

May be a boolean value, such as “true” or “false”.

Otherwise, you can try overriding the dispatch method of your root view and place a try catch there, you can use it as a custom Component if needed.

@Override
void dispatchTouchEvent(MotionEvent event){
    try{
        super.dispatchTouchEvent(event);
    }
    catch (Exception e){
        e.printStackTrace();
    }
}

Leave a Comment