4

I am trying to make a snake game. I've been testing the game on my nexus 4 which has it's back /home buttons as touch buttons so when I wanted to full screen activity the touch buttons would appear over the activity so to remove them I use the following code :

view.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE
            | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
            | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
            | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
            | View.SYSTEM_UI_FLAG_FULLSCREEN
            | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);

But when I tested the game on my friend's sony ericson phone which has hardware buttons. So on his phone the bottom edge of the screen extends more towards the area behind the buttons. How do i fix that?

This is how i'm getting the screen size :

    DisplayMetrics metrics = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(metrics);   
    height = metrics.heightPixels;
    width = metrics.widthPixels;
  • 1
    http://stackoverflow.com/questions/24358645/how-to-detect-hard-soft-back-button-on-android-device – waqaslam Jul 25 '14 at 08:04

1 Answers1

0

I'm 99% sure they are programmatically the same. One uses your bodies electrical resistance to trigger the signal, the other uses a mechanical switch. It's like a door knob, it can be round, or it can have a handle. If you are talking about a UI overlay to mimic a real button, that is all well hidden in the OS and at your level, it will again be the same programmatically. In the last case, the door knob analogy, it is now an automatic opening one :-)

But to give you a solution.. make your own GUI buttons in the ap and don't rely on hardware.

StarWind0
  • 1,554
  • 2
  • 17
  • 46
  • I don't think you got what I wanted. The problem is when hardware buttons exist the app screen extends as in the ericson phone the app screen extends further downwards and when they don't the size is perfect to the width. – user3875963 Jul 25 '14 at 08:38