public static void convertActivityToTranslucentBeforeL ( Activity activity ) { try { Class < ? > [ ] classes = Activity . class . getDeclaredClasses ( ) ; Class < ? > translucentConversionListenerClazz = null ; for ( Class clazz : classes ) { if ( clazz . getSimpleName ( ) . contains ( "TranslucentConversionListener" ) ) { translucentConversionListenerClazz = clazz ; } } Method method = Activity . class . getDeclaredMethod ( "convertToTranslucent" , translucentConversionListenerClazz ) ; method . setAccessible ( true ) ; method . invoke ( activity , new Object [ ] { null } ) ; } catch ( Throwable t ) { } }
Calling the convertToTranslucent method on platforms before Android 5 . 0