When I set the style of a dialog fragment, the android is allowing to take the screen shot of dialog fragment, but after removing the style it works.
Below is the code of dialog fragment's onCreate
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setStyle(DialogFragment.STYLE_NO_TITLE, android.R.style.Theme_Holo_Light);
getActivity().getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE);
setCancelable(false);
}
Has any one else faced a similar issue before?
AFAICT, using FLAG_SECURE on the hosting activity is insufficient to make a DialogFragment secure.
In addition to using FLAG_SECURE for the activity, call getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE); on the Dialog that you create in onCreate() of the DialogFragment, before you return that Dialog.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With