One way is to guess it from display metrics. There are two ways to get metrics: the first (and older) gives the size of the “inner” window, without system bar, the second gives the size of the real screen, including the system bar. By comparing width or height given by these two methods you can guess that there is a navigation bar.
Something like this may work (not tested):
var ctx = LL.getContext(); // this is an instance of Activity, except when called from a background script
< ![CDATA[
One way is to guess it from display metrics. There are two ways to get metrics: the first (and older) gives the size of the “inner” window, without system bar, the second gives the size of the real screen, including the system bar. By comparing width or height given by these two methods you can guess that there is a navigation bar.
Something like this may work (not tested):
var ctx = LL.getContext(); // this is an instance of Activity, except when called from a background script
DisplayMetrics dm = ctx.getResources().getDisplayMetrics();
DisplayMetrics realDm = new DisplayMetrics();
ctx.getWindowManager().getDefaultDisplay().getRealMetrics(realDm);
Then compare dm.heightPixels and realDm.heightPixels
You also need to check for the android version because getRealMetrics is available at API 17.
]]>
< ![CDATA[
Pierre Hébert
Thank Pierre!
I’m making the template now, so i need data about whether navigation bar available or not.
]]>