title: how to logout from an fragment to activity
body: <p>I am trying to logout from my developing app.My app is in a drawer Layout and from the drawer each time I am calling an fragment.But this time I want to call an activity which is in another package.Eventually facing an error.. Unfortunately stopped. What to do !!! Can someone suggest me!!!</p>
  
  <p>Here is the code..</p>
  
  <pre><code>private void selectItemFragment(int position){
  
      Fragment fragment = null;
      FragmentManager fragmentManager = getSupportFragmentManager();
      switch(position) {
          default:
          case 0:
              fragment = new ProfileFragment();
              Toast.makeText(getApplicationContext(),"Profile Fragment 1"+position,Toast.LENGTH_LONG).show();
              break;
          case 1:
              fragment = new UploadQuestionFragment();
              Toast.makeText(getApplicationContext(),"Fragment 2 "+position,Toast.LENGTH_LONG).show();
              break;
          case 2:
              fragment = new DefaultFragment();
              Toast.makeText(getApplicationContext(),"Fragment 3"+position,Toast.LENGTH_LONG).show();
              break;
          case 3:
              fragment = new DefaultFragment();
              Toast.makeText(getApplicationContext(),"Fragment 4 "+position,Toast.LENGTH_LONG).show();
              break;
          case 4:
              fragment = new DefaultFragment();
              Toast.makeText(getApplicationContext(),"Fragment 5 "+position,Toast.LENGTH_LONG).show();
          break;
          case 5:
              //fragment = new LogOutFragment();
              Intent intent = new Intent(MainActivity.this, FirstActivity.class);
              startActivity(intent);
              break;
  
      }
      fragmentManager.beginTransaction().replace(R.id.main_fragment_container, fragment).commit();
  
      mDrawerList.setItemChecked(position, true);
      setTitle(titles[position]);
      mDrawerLayout.closeDrawer(mDrawerList);
  }
  </code></pre>