public static @ Nullable View . OnClickListener guarded ( @ Nullable final View . OnClickListener listener ) { if ( listener != null ) { return new View . OnClickListener ( ) { @ Override public void onClick ( View v ) { try { listener . onClick ( v ) ; } catch ( Exception e ) { ApptentiveLog . e ( e , "Exception while handling click listener" ) ; logException ( e ) ; } } } ; } return null ; }
Creates a fail - safe try .. catch wrapped listener