Java tutorial
//package com.java2s; //License from project: Apache License import android.app.Activity; import java.lang.reflect.Method; public class Main { /** * Calling the convertToTranslucent method on platforms before Android 5.0 */ 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) { } } }