0

this.navDrawerToggle = new ActionBarDrawerToggle(this,this.getApplicationContext(), this.navDrawerLayout,R.drawable.ic_drawer, R.string.app_name, R.string.app_name ){
            @Override
            public void onDrawerOpened(View drawerView) {
                getActionBar().setTitle(navDrawerTitle);
                invalidateOptionsMenu();
            }

            @Override
            public void onDrawerClosed(View drawerView) {
                getActionBar().setTitle(appTitle);
                invalidateOptionsMenu();
            }
        };

I'm new to android i i'm making an app in which i was using Navigation Drawer i was following a tutorial but then in the end i stuck on ActionBarDrawerToggle() which i think is now deprecated and that tutorial was made earlier please can anyone tell me how to use deprecated ActionBarDrawerToggle or any other way to use android.support.v4.app.ActionBarDrawerToggle; ?? please explain in detail as i'm new to android and programming.
enter image description here i also imported import android.support.v4.app.ActionBarDrawerToggle; import android.support.v4.widget.DrawerLayout; import android.support.v7.app.ActionBarActivity;

but still not working.

Jazz
  • 31
  • 3

2 Answers2

1

As the official oracle Java documentation hints,

You may have heard the term, "self-deprecating humor," or humor that minimizes the speaker's importance. A deprecated class or method is like that. It is no longer important. It is so unimportant, in fact, that you should no longer use it, since it has been superseded and may cease to exist in the future.

And also stated in the official android documentation

This class is deprecated. Please use ActionBarDrawerToggle in support-v7-appcompat.

That being said, you should try to find a different solution to your problem. For example, you could use the support v7 version as suggested by the Android docs. Here is an example on what you could do instead of using a deprecated class.

Community
  • 1
  • 1
Marcus
  • 6,697
  • 11
  • 46
  • 89
0

Do not use the support v4 ActionBarDrawerToggle. Deprecated libraries will crash your app unexpectedly. I know this by experience. Use the support v7 one. Here is a pretty simple implementation.

denvercoder9
  • 2,979
  • 3
  • 28
  • 41