Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to detect if an Android phone has a trackball?

My application requires users to hold down the trackball in order to access an advanced menu. Not all phones have a trackball, however, so I need to remove this requirement for such phones. Is there a way to detect if the phone has a trackball?

like image 799
Aaron C Avatar asked Sep 08 '10 14:09

Aaron C


1 Answers

Use the Configuration object, specifically the navigation and navigationHidden fields. You can get a Configuration object via getResources().getConfiguration().

like image 92
CommonsWare Avatar answered Oct 11 '22 23:10

CommonsWare