'ActionBarDrawerToggle doesn't accept String as parameter
the Red line is under "Open navigation drawer" and "Close navigation drawer"
import androidx.appcompat.app.ActionBarDrawerToggle;
setContentView(R.layout.activity_home);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
toolbar.setTitle("Menu");
setSupportActionBar(toolbar);
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toogle = new ActionBarDrawerToggle(this,
drawer,
toolbar ,
"Open navigation drawer",
"Close navigation drawer"
);
drawer.setDrawerListener(toogle);
toogle.syncState();
Solution 1:[1]
According to Android official docs openDrawerContentDescRes and closeDrawerContentDescRes are of int datatype.
ActionBarDrawerToggle (Activity activity,
DrawerLayout drawerLayout,
int openDrawerContentDescRes,
int closeDrawerContentDescRes)
So you need to change your string to string resource id ( R.string.YOUR_STRING) to describe the "open drawer" and "close drawer" action for accessibility.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Priyanshu |
