title: SlidingMenu Fragment Switch Listener Null Pointer Exception
body: <p>I'm calling on this acitvity as my main laucher this activity extends the SlidingActivity from this library <a href="https://github.com/jfeinstein10/SlidingMenu" rel="nofollow">https://github.com/jfeinstein10/SlidingMenu</a>.  When it creates a behindcontentview for the slidingmenu I use with a fragment.  In this main activity I creating a custom view for a calendar  there are icons that are drawed in this custom view. I want to toggle these icons so I'm using switches in the sliding menu fragment view but I'm getting a null pointer exception which log cat saids its happens in the listner when i toggle in the fragment where the switch is.  So my code to clears the  icons on a calendar that is made using the custom view in the main activty and  does work with I use the code in the main activity but not within the toggle listner OnCheckedChangeListener.</p>
  
  <p>Heres Mainactivity that calls on the slide menu and fragment to fill the slide menu</p>
  
  <pre><code>    setBehindContentView(R.layout.menu_frame);
      FragmentTransaction t = this.getSupportFragmentManager().beginTransaction();
      mFrag = new ColorFragment();
      t.replace(R.id.menu_frame, mFrag);
      t.commit();
  
      // customize the SlidingMenu
      SlidingMenu sm = getSlidingMenu();
      sm.setShadowWidthRes(R.dimen.shadow_width);
      sm.setShadowDrawable(R.drawable.shadow);
      sm.setBehindOffsetRes(R.dimen.slidingmenu_offset);
      sm.setFadeDegree(0.35f);
      sm.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
      //sm.attachToActivity(this, SlidingMenu.SLIDING_WINDOW);
  
  
  
      getSupportActionBar().setDisplayHomeAsUpEnabled(true);
      //redrawtest();
     // setListener();
  </code></pre>
  
  <p>Heres my xml for this main activity.</p>
  
  <pre><code> &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"&gt;
  
  &lt;com.projects.shiftcalendar.CalendarView
      android:id="@+id/view_month_calendar"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"&gt;
  &lt;/com.projects.shiftcalendar.CalendarView&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>This is my fragment</p>
  
  <pre><code>public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle
  savedInstanceState) {
      return inflater.inflate(R.layout.slide_menu_toggle, null );
  
  }
  
  public void onActivityCreated(Bundle savedInstanceState) {
      super.onActivityCreated(savedInstanceState);
  
      Switch d = (Switch) getView().findViewById(R.id.monitored_switch1);
      d.setOnCheckedChangeListener(this);
  
  
  }
  
  public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
  
  
  
      if(isChecked){
  
          cv.redrawCalendarClearSymbol();
  
  
  
      }
      else {
  
          cv.redrawCalendarClearSymbol();
  
  
        }
  
  
  
    }
  
  
  }
  </code></pre>