title: cannot resolve symbol 'toolbar' r.id.toolbar
body: <p>i'm trying to create a sliding drawer.  I spent forever getting my imports to match my code, in terms of getSupportActionBar vs getActionBar etc., I suspect the issue is somewhere in the activity_main.xml but I'm at a loss for what to put there.</p>
  
  <p><strong>MainActivity.java</strong></p>
  
  <pre><code>package me.paxana.alerta;
  
  import android.app.Activity;
  import android.support.v4.app.FragmentActivity;
  import android.support.v4.app.FragmentTransaction;
  import android.support.v4.app.FragmentManager;
  import android.support.v7.app.ActionBar;
  import android.support.v7.app.ActionBarDrawerToggle;
  import android.app.Fragment;
  import android.content.Intent;
  import android.support.v4.widget.DrawerLayout;
  import android.support.v7.app.ActionBarActivity;
  import android.support.v7.app.AppCompatActivity;
  import android.os.Bundle;
  import android.util.Log;
  import android.view.Menu;
  import android.view.MenuItem;
  import android.view.MenuInflater;
  import android.view.View;
  import android.widget.AdapterView;
  import android.widget.Button;
  import android.widget.ListView;
  import android.widget.RelativeLayout;
  import android.support.v7.app.ActionBarActivity;
  import android.support.v7.widget.Toolbar;
  
  import com.parse.ParseUser;
  
  import java.util.ArrayList;
  import java.util.List;
  
  import butterknife.Bind;
  import butterknife.ButterKnife;
  import me.paxana.alerta.adapter.SlidingMenuAdapter;
  import me.paxana.alerta.fragment.Fragment1;
  import me.paxana.alerta.fragment.Fragment2;
  import me.paxana.alerta.fragment.Fragment3;
  import me.paxana.alerta.model.ItemSlideMenu;
  
  public class MainActivity extends AppCompatActivity {
      public static final String TAG = MainActivity.class.getSimpleName();
      private List&lt;ItemSlideMenu&gt; listSliding;
      private SlidingMenuAdapter adapter;
      private ListView listViewSliding;
      private DrawerLayout drawerLayout;
      private android.support.v7.app.ActionBarDrawerToggle actionBarDrawerToggle;
      private Toolbar mToolbar;
  
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          ButterKnife.bind(this);
  
  
          ParseUser currentUser = ParseUser.getCurrentUser();
               if (currentUser == null) {
                  navigateToLogin();
              }
  
          else {
                  Log.i(TAG, currentUser.getUsername());
              }
  
          listViewSliding = (ListView)findViewById(R.id.lv_sliding_menu);
          drawerLayout = (DrawerLayout)findViewById(R.id.drawer_layout);
          listSliding = new ArrayList&lt;&gt;();
          //add item for sliding list
          listSliding. add(new ItemSlideMenu(R.drawable.ic_action_settings, "Settings"));
          listSliding.add(new ItemSlideMenu(R.drawable.ic_action_about, "About"));
          listSliding.add(new ItemSlideMenu(R.mipmap.ic_launcher, "Android"));
          adapter = new SlidingMenuAdapter(this, listSliding);
          listViewSliding.setAdapter(adapter);
  
  
          //display icon to open/close slider
          mToolbar = (Toolbar) findViewById(R.id.toolbar);
          setSupportActionBar(mToolbar);
          assert getActionBar() != null;
          getActionBar().setDisplayHomeAsUpEnabled(true);
  
          //set title
          setTitle(listSliding.get(0).getTitle());
          //item selected
          listViewSliding.setItemChecked(0, true);
          //close menu
          drawerLayout.closeDrawer(listViewSliding);
          //handle on item click
          listViewSliding.setOnItemClickListener(new AdapterView.OnItemClickListener() {
              @Override
              public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) {
                  //set title
                  setTitle(listSliding.get(position).getTitle());
                  //item selected
                  listViewSliding.setItemChecked(position, true);
                  //close menu
                  drawerLayout.closeDrawer(listViewSliding);
              }
  
          });
  
          actionBarDrawerToggle = new ActionBarDrawerToggle(this, drawerLayout, R.string.drawer_opened, R.string.drawer_closed) {
              @Override
              public void onDrawerOpened(View drawerView) {
                  super.onDrawerOpened(drawerView);
                  invalidateOptionsMenu();
              }
  
              @Override
              public void onDrawerClosed(View drawerView) {
                  super.onDrawerClosed(drawerView);
                  invalidateOptionsMenu();
              }
          };
  
          drawerLayout.setDrawerListener(actionBarDrawerToggle);
  
      }
  
      private void navigateToLogin() {
          Intent intent = new Intent(this, LoginActivity.class);
          intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
          intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
          startActivity(intent);
      }
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          MenuInflater inflater = getMenuInflater();
          inflater.inflate(R.menu.menu_main, menu);
          return true;
      }
  
      @Override
      public boolean onOptionsItemSelected(MenuItem item) {
          if(actionBarDrawerToggle.onOptionsItemSelected(item)) {
              return true;
          }
  
          int itemId = item.getItemId();
          if (itemId == R.id.action_logout) {
              ParseUser.logOut();
              navigateToLogin();
  
          }
          return super.onOptionsItemSelected(item);
      }
  
      @Override
      protected void onPostCreate(Bundle savedInstanceState) {
          super.onPostCreate(savedInstanceState);
          actionBarDrawerToggle.syncState();
      }
  //create method replace fragment
      private void replaceFragment(int pos) {
          android.support.v4.app.Fragment fragment = null;
          switch (pos) {
              case 0:
                  fragment = new Fragment1();
                      break;
              case 1:
                  fragment = new Fragment2();
                  break;
              case 2:
                  fragment = new Fragment3();
                  break;
              default:
                  fragment = new Fragment1();
                  break;
          }
          if(null != fragment) {
              android.support.v4.app.FragmentManager fragmentManager = getSupportFragmentManager();
              android.support.v4.app.FragmentTransaction transaction = fragmentManager.beginTransaction();
              transaction.replace(R.id.main_content, fragment);
              transaction.addToBackStack(null);
              transaction.commit();
  
          }
      }
  }
  </code></pre>
  
  <p><strong>activity_main.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:id="@+id/drawer_layout"
      tools:context="me.paxana.alerta.MainActivity"&gt;
  
      &lt;RelativeLayout
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:id="@+id/main_content"&gt;
      &lt;/RelativeLayout&gt;
  
      &lt;ListView
          android:layout_width="200dp"
          android:layout_height="match_parent"
          android:id="@+id/lv_sliding_menu"
          android:background="#FFFFFF"
          android:choiceMode="singleChoice"
          android:layout_gravity="start" /&gt;
  &lt;/android.support.v7.widget.Toolbar&gt;
  </code></pre>