title: Confuse when Using Navigation Drawer to Attach onClickItemListener
body: <p>Here I am now developing an android app which using navigation drawer on the <code>MainActivity</code>. I'm stuck at this section, when I try to attach a <code>onItemClickListener</code> on the navigation drawer. So, now when user click on the item on Navigation Drawer, it's work (move to other activity which user click) when user press back, it's going to the <code>MainActivity</code> (still what i want) but when on the <code>MainActivity</code> when user press back again to exit, the app does not exit properly, it's move to another activity which is (always) New Transaction Activity( this what I don't want), this just happen when user click on the Navigation Drawer.</p>
  
  <p>Example :
  On Navigation Drawer I have this list :
  New Tranasaction
  Reminder
  Import Data
  Export Data
  Category Setting</p>
  
  <p>Let's say user click on Reminder, so user will moved to <code>ReminderActivity</code>, when user press back, it's moved to <code>MainActivity</code> but when user press back again to exit, it's not exit, but it's moved to New Transaction Activity (always this activity) this just happen when user press an item on Navigation drawer.
  Please master help me, I have stuck here for 2 weeks.</p>
  
  <p>Thanks Before.</p>
  
  <p>NB. This my code for <code>NavigationDrawerFragment.java</code> (where i set the <code>onClickListener</code>) :</p>
  
  <pre><code>public class NavigationDrawerFragment extends Fragment implements GookAdapter.ClickListener {
  private GookAdapter adapter;
  private RecyclerView recyclerView;
  public static final String PREF_FILE_NAME="testpref";
  public static final String KEY_USER_LEARNED_DRAWER="user_learned_drawer";
  private ActionBarDrawerToggle mDrawerToggle;
  private DrawerLayout mDrawerLayout;
  private boolean mUserLearnedDrawer;
  private boolean mFromSavedInstanceState;
  private View containerView;
  
  public NavigationDrawerFragment() {
      // Required empty public constructor
  }
  
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      mUserLearnedDrawer = Boolean.valueOf(readFromPreference(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
      View layout = inflater.inflate(R.layout.fragment_navigation_drawer, container, false);
      recyclerView= (RecyclerView) layout.findViewById(R.id.drawerList);
      adapter = new GookAdapter(getActivity(), getData());
      adapter.setOnClickListener(this);
      recyclerView.setAdapter(adapter);
      recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
      return layout;
  }
  
  public static List&lt;Information&gt; getData(){
      List&lt;Information&gt; data = new ArrayList&lt;&gt;();
      int[] icons = {R.drawable.home,
                      R.drawable.reminder,
                      R.drawable.importdata,
                      R.drawable.exportdata,
                      R.drawable.settings};
      String [] titles = {"New Transaction", "Reminder", "Import Data", "Export Data", "Category Setting"};
      for (int i=0;i&lt;titles.length &amp;&amp; i&lt;icons.length;i++){
              Information current = new Information();
              current.iconId=icons[i%icons.length];
              current.title=titles[i%titles.length];
              data.add(current);
       }
      return data;
  }
  
  
  public void setUp(int fragmentId, DrawerLayout drawerLayout, Toolbar toolbar) {
      containerView=getActivity().findViewById(fragmentId);
      mDrawerLayout = drawerLayout;
      mDrawerToggle= new ActionBarDrawerToggle(getActivity(), drawerLayout, toolbar, R.string.drawerOpen, R.string.drawerClose){
          @Override
          public void onDrawerOpened(View drawerView) {
              super.onDrawerOpened(drawerView);
              if(!mUserLearnedDrawer){
                  mUserLearnedDrawer=true;
                  savedToPreferences(getActivity(), KEY_USER_LEARNED_DRAWER, mUserLearnedDrawer+"");
              }
              getActivity().invalidateOptionsMenu();
  
          }
  
          @Override
          public void onDrawerClosed(View drawerView) {
              super.onDrawerClosed(drawerView);
              getActivity().invalidateOptionsMenu();
          }
      };
  
      if(!mUserLearnedDrawer &amp;&amp; !mFromSavedInstanceState){
          mDrawerLayout.openDrawer(containerView);
      }
      mDrawerLayout.setDrawerListener(mDrawerToggle);
      mDrawerLayout.post(new Runnable() {
          @Override
          public void run() {
              mDrawerToggle.syncState();
          }
      });
  }
  
  
  
  public static void savedToPreferences(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 readFromPreference(Context context, String preferenceName, String defaultValue){
      SharedPreferences sharedPreferences = context.getSharedPreferences(PREF_FILE_NAME, Context.MODE_PRIVATE);
      return sharedPreferences.getString(preferenceName, defaultValue);
  }
  
  @Override
  public void itemClicked(View view, int position) {
      if(position == 0){
          startActivity(new Intent(getActivity(), NewTransaction.class));
          getActivity().finish();
      }else if(position == 1){
          startActivity(new Intent(getActivity(), Reminder.class));
          getActivity().finish();
      }else if(position == 2){
          startActivity(new Intent(getActivity(), Reminder.class));
          getActivity().finish();
      }else if(position == 3){
          startActivity(new Intent(getActivity(), Reminder.class));
          getActivity().finish();
      }else{
          startActivity(new Intent(getActivity(), CategorySetting.class));
      }
  
  }
  </code></pre>
  
  <p>}</p>