Hello. There is a code, it gives the opportunity to open the left curtain and adds a hamburger. You need to make sure that the curtain is on several activites. Delivered logic to this class, the necessary activations inherited from this class. A hamburger appeared but does not respond to pressing. Where is the mistake?
public class Menu extends AppCompatActivity { private DrawerLayout mDrawerLayout; private ListView mDrawerListView; private String[] mCatTitles; private ActionBarDrawerToggle mDrawerToggle; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_menu); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mCatTitles = getResources().getStringArray(R.array.cats_array_ru); mDrawerListView = (ListView) findViewById(R.id.left_drawer); // подключим адаптер для списка ListAdapter adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, mCatTitles); mDrawerListView.setAdapter(adapter); mDrawerListView.setOnItemClickListener(new Menu.DrawerItemClickListener()); // Включаем значок у ActionBar для управления выдвижной панелью щелчком getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setHomeButtonEnabled(true); // ActionBarDrawerToggle ties together the the proper interactions // between the sliding drawer and the action bar app icon mDrawerToggle = new ActionBarDrawerToggle( this, /* host Activity */ mDrawerLayout, /* DrawerLayout object */ null, /* значок-гамбургер для замены стрелки 'Up' */ R.string.app_name, /* добавьте строку "open drawer" - описание для accessibility */ R.string.app_name /* добавьте "close drawer" - описание для accessibility */ ) { public void onDrawerClosed(View view) { getSupportActionBar().setTitle(R.string.app_name); invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu() } public void onDrawerOpened(View drawerView) { getSupportActionBar().setTitle(R.string.app_name); invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu() } }; mDrawerLayout.setDrawerListener(mDrawerToggle); if (savedInstanceState == null) { selectItem(0); } } // Слушатель для элементов списка в выдвижной панели private class DrawerItemClickListener implements ListView.OnItemClickListener { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { selectItem(position); } } private void selectItem(int position) { if (position == 2) { Intent intent = new Intent(this, Main2Activity.class); startActivity(intent); } } @Override public boolean onOptionsItemSelected(MenuItem item) { // The action bar home/up action should open or close the drawer. // ActionBarDrawerToggle will take care of this. if (mDrawerToggle.onOptionsItemSelected(item)) { return true; } // Handle action buttons switch(item.getItemId()) { case R.id.email: // create intent to perform web search for this cat Intent intent = new Intent(Intent.ACTION_WEB_SEARCH); intent.putExtra(SearchManager.QUERY, getSupportActionBar().getTitle()); // catch event that there's no activity to handle intent if (intent.resolveActivity(getPackageManager()) != null) { startActivity(intent); } else { Toast.makeText(this, R.string.app_name, Toast.LENGTH_LONG).show(); } return true; default: return super.onOptionsItemSelected(item); } } @Override protected void onPostCreate(Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); // Sync the toggle state after onRestoreInstanceState has occurred. mDrawerToggle.syncState(); } }