Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

which is better add flag or set flag regard full screen and screen on

I wonder which is better in performance and behavior between the following ways in achieving:

  1. Full Screen.

  2. Screen On.

or both is the same

First:

getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, 
            WindowManager.LayoutParams.FLAG_FULLSCREEN); 

OR

getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN |
WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

MAYBE this is easy question but I'm still learning android development,

Any help will be appreciated,

Thanks.

like image 878
androidqq6 Avatar asked Nov 20 '12 10:11

androidqq6


2 Answers

I don't think both scenarios affect performance a lot, but in modern developing environment we prefer simplicity of coding which directly seen in

 getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN |
      WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

so definitely I vote for that

like image 106
Mohd Mufiz Avatar answered Oct 16 '22 04:10

Mohd Mufiz


Try this

    getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);  
    getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

For more Follow this Link

like image 34
Arvind Kanjariya Avatar answered Oct 16 '22 04:10

Arvind Kanjariya