I need to put a screen in fullscreen in my app. For this I am using this code:
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
requestWindowFeature(Window.FEATURE_NO_TITLE)
window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN)
setContentView(R.layout.activity_camera_photo)
However, the WindowManager.LayoutParams.FLAG_FULLSCREEN flag is deprecated.
My app supports Android Lollipop (API 21) to Android R (API 30). What is the correct way to make a screen go fullscreen?
For API >= 30, use
WindowInsetsController.hide():