Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android ICS : How to detect that a device have "on screen Back/Home button" (Like Galaxy Nexus)

I wanted to know if there was a way to detect if the device have "on screen buttons" (like the Galaxy Nexus or ICS tablets)

My issue is that in devices with on screen button, on the action, bar the overflow button is added (if overflow), and not on other devices, so I would like to be able to predict this kind of behavior.

Thank you for your help.

like image 771
Atomusk Avatar asked Feb 02 '12 00:02

Atomusk


1 Answers

From your Activity you can run the following command:

boolean hasNavigationBar = false;

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH)
{
    hasNavigationBar = !ViewConfiguration.get(context).hasPermanentMenuKey();
}    
else 
{
    hasNavigationBar = false;
}
like image 67
EyalBellisha Avatar answered Nov 18 '22 16:11

EyalBellisha