Code example for InvocationTargetException

Methods: getCause

0
                return; 
            } 
            mRegisterMediaButtonEventReceiver.invoke(mAudioManager, mRemoteControlResponder);
        } catch (InvocationTargetException ite) {
            /* unpack original exception when possible */ 
            Throwable cause = ite.getCause();
            if (cause instanceof RuntimeException) {
                throw (RuntimeException) cause;
            } else if (cause instanceof Error) {
                throw (Error) cause;
            } else { 
                /* unexpected checked exception; wrap and re-throw */ 
                throw new RuntimeException(ite);
            } 
        } catch (IllegalAccessException ie) {
            Log.e(TAG, "unexpected " + ie);
        } 
    } 
 
    public void unregisterRemoteControl() { 
        try {