Android - constructor for ActionBarDrawerToggle is undefined
I used this code in my oncreate function to open the navigation drawer by clicking the application icon.
ActionBarDrawerToggle mDrawerToggle = new ActionBarDrawerToggle(
this, /* host Activity */
(DrawerLayout) findViewById(R.id.left_drawer), /* DrawerLayout object */
getResources().getDrawable(R.drawable.ic_drawer), /* nav drawer icon to replace 'Up' caret */
getString(R.string.drawer_open), /* "open drawer" description */
getString(R.string.drawer_close) /* "close drawer" description */
) {
/** Called when a drawer has settled in a completely closed state. */
public void onDrawerClosed(View view) {
getActionBar().setTitle(R.string.title_activity_add);
}
/** Called when a drawer has settled in a completely open state. */
public void onDrawerOpened(View drawerView) {
getActionBar().setTitle(R.string.drawer_title);
}
};
Now he says, "The constructor for ActionBarDrawerToggle (AddActivity, DrawerLayout, Drawable, String, String) is undefined." I have imported android.support.v4.app.ActionBarDrawerToggle. Where is the problem?
+1
source to share