Android screen flash when removeView -
i have activity , several fragments. 1 fragment, want disable screenshot function. in oncreate function, set flags window, found doesn't work. maybe system needs reload window. try remove current window , add back. work, find screen black 1 second. how can solve screen flash problem? oncreate fragment. can't set flag in activity since disable screenshot fragments.
public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); if (build.version.sdk_int >= build.version_codes.honeycomb) { getactivity().getwindow().setflags(layoutparams.flag_secure, layoutparams.flag_secure); window window = getactivity().getwindow(); windowmanager wm = getactivity().getwindowmanager(); wm.removeviewimmediate(window.getdecorview()); wm.addview(window.getdecorview(), window.getattributes()); } }
i believe correct need set flag before setcontentview(...) on activity, otherwise 1 thing can try using getactivity().recreate() after setting flag_secure
Comments
Post a Comment