String eglErrorToString ( int errorCode ) { if ( errorCode >= 0x3000 && errorCode < 0x3020 ) { for ( Field field : EGL . class . getFields ( ) ) { try { if ( field . getName ( ) . startsWith ( "EGL_" ) && field . getType ( ) == Integer . TYPE && field . getInt ( null ) == errorCode ) { return field . getName ( ) ; } } catch ( IllegalAccessException e ) { } } } return new Formatter ( ) . format ( "0x%04x" , errorCode & 0xffff ) . out ( ) . toString ( ) ; }
Convert an EGL error code such as EGL_BAD_CONTEXT to a string representation .