title: Using intent inside OncheckedChanged
body: <p>May i know how should i call the intent to next activity in this line?(case 3)
  It is inside OncheckedChanged of a switch.</p>
  
  <p>I was getting the error</p>
  
  <pre><code>Home.this cannot be referenced from static context
  </code></pre>
  
  <p>My activity is as follow:</p>
  
  <pre><code>......
  .....
  
          @Override
          public View onCreateView(LayoutInflater inflater, ViewGroup container,
                                   Bundle savedInstanceState) {
              View rootView = new View(this.getActivity());
              ARG_NUMBER = getArguments().getInt(ARG_SECTION_NUMBER, 0);
  
              switch (ARG_NUMBER) {
                  case 1:
                      rootView = inflater.inflate(R.layout.fragment_home, container, false);
                      break;
                  case 2:
                      rootView = inflater.inflate(R.layout.fragment_stamp, container, false);
                      break;
                  case 3:
                      rootView = inflater.inflate(R.layout.fragment_setting, container, false);
                      //to be optimize
                      Switch passcode_switch = (Switch) rootView.findViewById(R.id.switch1);
                      passcode_switch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
                          @Override
                          public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) {
                              if(isChecked){
                                  Log.d("Switch State=", "" + "Is checked");
                                  Toast.makeText(getActivity(), "Generated!", Toast.LENGTH_SHORT).show();
  
                                  final Intent setup_passcode = new Intent(Home.this, Passcode.class);
                                  startActivity(setup_passcode);
  
                              }else{
                                  Log.d("Switch State=", "" + "NOT checked");
  
                              }
                          }
                      });
                      break;
              }
              return rootView;
  ....
  ....
  </code></pre>
  
  <p>i cannot call intent for the line:</p>
  
  <pre><code>final Intent setup_passcode = new Intent(Home.this, Passcode.class);
                                  startActivity(setup_passcode);
  </code></pre>