title: Android Studio Navigation Drawer cannot find symbol variable mDrawerLayout or KEY_USER_LEARNED_DRAWER
body: <p>I'm following Slidnerd's Material Design tutorial in android studio and I am stuck in the navigation drawer.</p>
  
  <p>Here is my NavigationDrawerFragment.java</p>
  
  <pre><code>            package com.example.baumann.perfectposture;
  
  
              import android.content.Context;
              import android.content.SharedPreferences;
              import android.os.Bundle;
              import android.support.v4.app.Fragment;
              import android.support.v4.widget.DrawerLayout;
              import android.support.v7.app.ActionBarDrawerToggle;
              import android.support.v7.widget.Toolbar;
              import android.view.LayoutInflater;
              import android.view.View;
              import android.view.ViewGroup;
              import android.content.ComponentName;
              import android.content.Intent;
              import android.graphics.drawable.Drawable;
              import android.os.Bundle;
              import android.os.Handler;
              import android.support.v4.app.Fragment;
              import android.support.v4.app.FragmentManager;
              import android.support.v4.app.FragmentStatePagerAdapter;
              import android.support.v4.view.ViewPager;
              import android.support.v4.widget.DrawerLayout;
              import android.support.v7.app.ActionBarActivity;
              import android.support.v7.widget.Toolbar;
              import android.view.Menu;
              import android.view.MenuItem;
              import android.view.View;
              import android.view.ViewGroup;
              import android.widget.ImageView;
  
  
              /**
               * A simple {@link Fragment} subclass.
               */
              public class NavigationDrawerFragment extends Fragment {
  
                  public static final String PREF_FILE_NAME="testpref";
                  public static final String KEY_USER_LEARNED_DRAWER="user_learned_drawer";
                  private ActionBarDrawerToggle mDrawerToggle;
  
                  private boolean mUserLearnedDrawer;
                  private boolean mFromSavedInstanceState;
  
                  public NavigationDrawerFragment() {
                      // Required empty public constructor
                  }
  
                  @Override
                  public void onCreate(Bundle savedInstanceState) {
                      super.onCreate(savedInstanceState);
                      mUserLearnedDrawer=Boolean.valueOf(readFromPreferences(getActivity().KEY_USER_LEARNED_DRAWER,"false"));   
                      if(savedInstanceState==null){
                          mFromSavedInstanceState=true;
                      }
                  }
  
                  @Override
                  public View onCreateView(LayoutInflater inflater, ViewGroup container,
                                           Bundle savedInstanceState) {
                      // Inflate the layout for this fragment
                      return inflater.inflate(R.layout.fragment_navigation_drawer, container, false);
                  }
  
  
                  public void setUp(DrawerLayout drawerLayout, Toolbar toolbar) {
                      mDrawerLayout = drawerLayout;
                      mDrawerToggle = new ActionBarDrawerToggle(getActivity(), drawerLayout, toolbar, R.string.drawer_open, R.string.drawer_closed) {
                          @Override
                          public void onDrawerOpened(View drawerView) {
                              super.onDrawerOpened(drawerView);
                          }
  
                          @Override
                          public void onDrawerClosed(View drawerView) {
                              super.onDrawerClosed(drawerView);
                          }
                      };
                      mDrawerLayout.setDrawerListener(mDrawerToggle);
  
                  }
                      public static void saveToPreferences(Context context, String preferenceName, String preferenceValue){
                          SharedPreferences sharedPreferences=context.getSharedPreferences(PREF_FILE_NAME, Context.MODE_PRIVATE);
                          SharedPreferences.Editor editor=sharedPreferences.edit();
                          editor.putString(preferenceName, preferenceValue);
                          editor.apply();
                      }
                      public static String readFromPreferences(Context context, String preferenceName, String defaultValue) {
                          SharedPreferences sharedPreferences = context.getSharedPreferences(PREF_FILE_NAME, Context.MODE_PRIVATE);
                          return sharedPreferences.getString(preferenceName,defaultValue);
                      }
  
              }
  </code></pre>
  
  <p>Here's what was underlined:</p>
  
  <p><code>"KEY_USER_LEARNED_DRAWER"</code> in:</p>
  
  <p><code>mUserLearnedDrawer=Boolean.valueOf(readFromPreferences(getActivity().KEY_USER_LEARNED_DRAWER,"false"));</code></p>
  
  <p>and </p>
  
  <p><code>"mDrawerLayout"</code> twice in:</p>
  
  <p><code>mDrawerLayout = drawerLayout;</code></p>
  
  <p>and</p>
  
  <p><code>mDrawerLayout.setDrawerListener(mDrawerToggle);</code></p>
  
  <p>Here are my three errors:</p>
  
  <p><code>Error:(52, 77) error: cannot find symbol variable KEY_USER_LEARNED_DRAWER
  Error:(67, 9) error: cannot find symbol variable mDrawerLayout
  Error:(79, 9) error: cannot find symbol variable mDrawerLayout</code></p>