public static void setToastShowWhenLocked(Toast toast) {
try {
Class<?> to = Class.forName("android.widget.Toast");
Method setShowWhenLocked = to.getDeclaredMethod("setShowWhenLocked", boolean.class);
setShowWhenLocked.invoke(toast,true);
} catch (Exception e) {
e.printStackTrace();
}
}