gt:         if (fragment != null) {
context: package in.imates.nevtest;
  
  import android.annotation.TargetApi;
  import android.graphics.Color;
  import android.graphics.drawable.ColorDrawable;
  import android.os.Build;
  import android.os.Bundle;
  import android.support.v4.app.Fragment;
  import android.support.v4.app.FragmentManager;
  import android.support.v4.app.FragmentTransaction;
  import android.support.v4.widget.DrawerLayout;
  import android.support.v7.app.AppCompatActivity;
  import android.support.v7.widget.Toolbar;
  import android.view.Menu;
  import android.view.MenuItem;
  import android.widget.ExpandableListView;
  import android.widget.ExpandableListView.OnChildClickListener;
  import android.widget.ExpandableListView.OnGroupClickListener;
  import android.widget.ExpandableListView.OnGroupCollapseListener;
  import android.widget.ExpandableListView.OnGroupExpandListener;
  import android.view.View;
  import android.widget.ExpandableListView;
  import android.widget.TextView;
  import android.widget.Toast;
  
  import java.util.ArrayList;
  import java.util.HashMap;
  import java.util.List;
  
  import static in.imates.nevtest.R.drawable.abc_dialog_material_background_light;
  
  
  public class MainActivity extends AppCompatActivity implements FragmentDrawer.FragmentDrawerListener {
  
      private static String TAG = MainActivity.class.getSimpleName();
  
      private Toolbar mToolbar;
      private FragmentDrawer drawerFragment;
      private TextView tv;
      ExpandableListAdapter listAdapter;
      ExpandableListView expListView;
      List<String> listDataHeader;
      HashMap<String, List<String>> listDataChild;
  
  
      @TargetApi(Build.VERSION_CODES.LOLLIPOP)
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          mToolbar = (Toolbar) findViewById(R.id.toolbar);
          //   setActionBar(mToolbar);
          setSupportActionBar(mToolbar);
          getSupportActionBar().setDisplayHomeAsUpEnabled(true);
          tv = (TextView) findViewById(R.id.title);
  
          expListView = (ExpandableListView) findViewById(R.id.lvExp);
  
          // preparing list data
          prepareListData();
  
          listAdapter = new ExpandableListAdapter(this, listDataHeader, listDataChild);
          expListView.setAdapter(listAdapter);
  
          expListView.setOnGroupClickListener(new OnGroupClickListener() {
  
              @Override
              public boolean onGroupClick(ExpandableListView parent, View v,
                                          int groupPosition, long id) {
                  // Toast.makeText(getApplicationContext(),
                  // "Group Clicked " + listDataHeader.get(groupPosition),
                  // Toast.LENGTH_SHORT).show();
                  return false;
  
  
              }
          });
  
          expListView.setOnGroupExpandListener(new OnGroupExpandListener() {
  
              @Override
              public void onGroupExpand(int groupPosition) {
                  Toast.makeText(getApplicationContext(),
                          listDataHeader.get(groupPosition) + " Expanded",
                          Toast.LENGTH_SHORT).show();
  
  
  
              }
          });
  
          // Listview Group collasped listener
          expListView.setOnGroupCollapseListener(new OnGroupCollapseListener() {
  
              @Override
              public void onGroupCollapse(int groupPosition) {
                  Toast.makeText(getApplicationContext(),
                          listDataHeader.get(groupPosition) + " Collapsed",
                          Toast.LENGTH_SHORT).show();
  
              }
          });
  
          // Listview on child click listener
          expListView.setOnChildClickListener(new OnChildClickListener() {
  
              @Override
              public boolean onChildClick(ExpandableListView parent, View v,
                                          int groupPosition, int childPosition, long id) {
                  // TODO Auto-generated method stub
                  Toast.makeText(
                          getApplicationContext(),
                          listDataHeader.get(groupPosition)
                                  + " : "
                                  + listDataChild.get(
                                  listDataHeader.get(groupPosition)).get(
                                  childPosition), Toast.LENGTH_SHORT)
                          .show();
                  parent.collapseGroup(groupPosition);
                  return false;
              }
          });
  
  
  
          drawerFragment = (FragmentDrawer)
                  getSupportFragmentManager().findFragmentById(R.id.fragment_navigation_drawer);
          drawerFragment.setUp(R.id.fragment_navigation_drawer, (DrawerLayout) findViewById(R.id.drawer_layout), mToolbar);
          drawerFragment.setDrawerListener(this);
     //     displayView(0);
      }
  
      private void prepareListData() {
          listDataHeader = new ArrayList<String>();
          listDataChild = new HashMap<String, List<String>>();
  
          // Adding child data
          listDataHeader.add("Top 250");
          listDataHeader.add("Now Showing");
          listDataHeader.add("Coming Soon..");
  
          // Adding child data
          List<String> top250 = new ArrayList<String>();
          top250.add("The Shawshank Redemption");
          top250.add("The Godfather");
          top250.add("The Godfather: Part II");
          top250.add("Pulp Fiction");
          top250.add("The Good, the Bad and the Ugly");
          top250.add("The Dark Knight");
          top250.add("12 Angry Men");
  
          List<String> nowShowing = new ArrayList<String>();
          nowShowing.add("The Conjuring");
          nowShowing.add("Despicable Me 2");
          nowShowing.add("Turbo");
          nowShowing.add("Grown Ups 2");
          nowShowing.add("Red 2");
          nowShowing.add("The Wolverine");
  
          List<String> comingSoon = new ArrayList<String>();
          comingSoon.add("2 Guns");
          comingSoon.add("The Smurfs 2");
          comingSoon.add("The Spectacular Now");
          comingSoon.add("The Canyons");
          comingSoon.add("Europa Report");
  
          listDataChild.put(listDataHeader.get(0), top250); // Header, Child data
          listDataChild.put(listDataHeader.get(1), nowShowing);
          listDataChild.put(listDataHeader.get(2), comingSoon);
      }
  
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          // Inflate the menu; this adds items to the action bar if it is present.
          getMenuInflater().inflate(R.menu.menu_main, menu);
          return true;
      }
  
      @Override
      public boolean onOptionsItemSelected(MenuItem item) {
          // Handle action bar item clicks here. The action bar will
          // automatically handle clicks on the Home/Up button, so long
          // as you specify a parent activity in AndroidManifest.xml.
          int id = item.getItemId();
  
          //noinspection SimplifiableIfStatement
          if (id == R.id.action_settings) {
              return true;
          }
          if (id == R.id.action_search) {
              Toast.makeText(getApplicationContext(), "Search action is selected!", Toast.LENGTH_SHORT).show();
              return true;
          }
  
          return super.onOptionsItemSelected(item);
      }
  
      @Override
      public void onDrawerItemSelected(View view, int position) {
          displayView(position);
  
      }
  
      private void displayView(int position) {
          Fragment fragment = null;
          String title = getString(R.string.app_name);
          switch (position) {
              case 0:
                  fragment = new HomeFragment();
                  title = getString(R.string.title_home);
                  break;
              case 1:
                  fragment = new FriendsFragment();
                  title = getString(R.string.title_friends);
                  break;
              case 2:
                  fragment = new MessagesFragment();
                  title = getString(R.string.title_messages);
                  break;
              default:
                  break;
          }
  
  