Q:

how to open fragment from navigation drawer list

I have a problem with opening fragment activities, I'm new on programming android devices but I think it is very interesting and i would like to make some applications for myself. 
I have a sample with sliding menu, everything it is working, so i have three list item (home, settings, about) I would like to open an activity when I press on one of them this is my mainActivity, it would be great if somebody should tell me how should I complete this code to be able to open other activities. 
thank you in advance. 
My MainActivity is:
public class MainActivity extends BaseActivity {
    FragmentStackManager fm, sliding_menu;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        setUpView();
        menuToggeleSetUp(savedInstanceState);
    }
     void setUpView() {
        fm = new FragmentStackManager(this);
        sliding_menu = new FragmentStackManager(this);
        drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
        fm.addFragment(new MainFragment(), R.id.main_frame, false, FragmentTransaction. TRANSIT_NONE, false);
        sliding_menu.addFragment(new SlidingMenuFragment(), R.id.slide_fragment, false, FragmentTransaction. TRANSIT_NONE, false);
    }
    void menuToggeleSetUp(Bundle savedInstanceState) {
        mDrawerToggle = new ActionBarDrawerToggle(this, drawer,
                R.drawable.ic_drawer, // nav menu toggle icon
                R.string.app_name
        ) {
            public void onDrawerClosed(View view) {
                getSupportActionBar().setTitle(mTitle);
                               invalidateOptionsMenu();
            }
            public void onDrawerOpened(View drawerView) {
                getSupportActionBar().setTitle(mDrawerTitle);
                                invalidateOptionsMenu();
            }
        };
        drawer.setDrawerListener(mDrawerToggle);

        if (savedInstanceState == null) {
                  }
    }
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
          getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }
    @Override
    protected void onPostCreate(Bundle savedInstanceState) {
        super.onPostCreate(savedInstanceState);
               mDrawerToggle.syncState();
    }
    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        int id = item.getItemId();
        if (mDrawerToggle.onOptionsItemSelected(item)) {
                     return true;
        }
        if (id == R.id.action_settings) {
            System.out.println("CLEAR SETTINGS STARTED");
            return true;
        }
        return super.onOptionsItemSelected(item);
    }

    @Override
    public void onConfigurationChanged(Configuration newConfig) {
        super.onConfigurationChanged(newConfig);
                mDrawerToggle.onConfigurationChanged(newConfig);
    }
}

thank you for your help 
bu i would like to keep this one because the hamburger animation so i found something that i completed my code but is got an error on logcat
if somebody should help me it would be great 
so what i did is this:
mDrawerList.setOnItemClickListener(new DrawerItemClickListener());
 private class DrawerItemClickListener implements ListView. OnItemClickListener {
    @Override
    public void onItemClick(AdapterView parent, View view, int position, long id) {
      updateDisplay(position);
    }
}
 private void updateDisplay(int position) {
    Fragment fragment = null;
    switch (position) {
        case 0:
            System.out.println("ACTIVITY ONE");
            //fragment = new Home_Fragment();
            break;
        case 1:
            //fragment = new Settings_Fragment();
            System.out.println("ACTIVITY TWO");
           // startActivity(new Intent(this, Preferences.class));

                break;
            //case 2:
            //  fragment = new TB_Fragment();
            //break;
        default:
            break;
    }
if (fragment ! = null) {
        android.app. FragmentManager fragmentManager = getFragmentManager();
        fragmentManager.beginTransaction().replace(R.id.frame_container, fragment).commit();

        // update selected item and title, then close the drawer
        //setTitle(menutitles[position]);
        drawer.closeDrawer(mDrawerList);
    } else {
        // error in creating fragment
        Log.e("MainActivity", "Error in creating fragment");
    }

an my logcat is

java.lang. RuntimeException: Unable to start activity ComponentInfo{com.intelligent_screen/com.intelligent.screen. View. MainActivity}: java.lang. NullPointerException: Attempt to invoke virtual method 'void android.widget. ListView.setOnItemClickListener(android.widget. AdapterView$OnItemClickListener)' on a null object reference

A:

For Navigation Drawer use this sample
https://developer.android.com/training/implementing-navigation/nav-drawer.html
which shows how to open fragment each navigation item click
and for opening new activity use this
Intent intent = new Intent(MainActivity.this, AnotherActivity.class);
finish();
startActivity(intent);

