0

I have an activity in my app which is not launcher. I want to add a navigation drawer with toggler. I tried following the instructions here http://developer.android.com/training/implementing-navigation/nav-drawer.html#ActionBarIcon

But my back navigation still shows up (It exits the app as I have added appropriate flags to the intent) How can I show the drawer toggler icon ?

Also android.support.v4.app.ActionBarDrawerToggler is deprecated, what should I use instead ?

Ishan
  • 3,303
  • 5
  • 29
  • 47

1 Answers1

0

for android.support.v4.app.ActionBarDrawerToggler is deprecated to use new one get support library supporv7 appcompact check here https://developer.android.com/intl/es/reference/android/support/v4/app/ActionBarDrawerToggle.html

and creating Navigation drawer here you get all information http://developer.android.com/intl/es/training/implementing-navigation/nav-drawer.html

code sample

DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
        ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
                this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
        drawer.setDrawerListener(toggle);
        toggle.syncState();

use the latest support library you will get done it easily and not use setHomeasUpEnabled(true)

Pavan
  • 5,016
  • 1
  • 26
  • 30
  • It says that I have to replace ActionBar with ToolBar. In https://developer.android.com/intl/es/reference/android/support/v7/app/AppCompatActivity.html#setSupportActionBar(android.support.v7.widget.Toolbar) the argument required is a https://developer.android.com/intl/es/reference/android/support/v7/widget/Toolbar.html Is there a standard toolbar for navigation drawer or do I have to make one from scratch ? – Ishan Oct 20 '15 at 16:41
  • you can make simple toolbar and set it as action bar runtime. Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); it will work like normal actionbar – Pavan Oct 21 '15 at 08:05