I have developed an app based on the "Navigation Drawer Activity" template in Android Studio. However, I have now discovered that it is not possible to open the navigation drawer with a bluetooth keyboard.
At first I thought I deleted code by mistake but when I created a new project and compiled it without any changes I found out that the navigation drawer is indeed not operable with the keyboard. I also tried all possible key combinations. Without success.
As I am not yet that experienced in programming, I am not sure how to solve this problem.
As far as I understand the code of the template, the following code in the MainActivity.java would have to be modified to solve the problem.
DrawerLayout drawer = findViewById(R.id.drawer_layout);
NavigationView navigationView = findViewById(R.id.nav_view);
// Passing each menu ID as a set of Ids because each
// menu should be considered as top level destinations.
mAppBarConfiguration = new AppBarConfiguration.Builder(
R.id.nav_home, R.id.contactFragment, R.id.imageFragment, R.id.editFieldFragment, R.id.headersFragment, R.id.contrastFragment, R.id.imageButtonFragment, R.id.tabOrderFragment)
.setDrawerLayout(drawer)
.build();
NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment);
NavigationUI.setupActionBarWithNavController(this, navController, mAppBarConfiguration);
NavigationUI.setupWithNavController(navigationView, navController);
}
You can find the complete project here AccessibilityDemo if you need it.
Can someone please help me solve this problem?
Many thanks in advance.
Kind regards
Petra Ritter