title: How to go to fragment from activity
body: <p>I am using ActionBarSherlock, I am not able to go to class that extends SherlockFragment from activity</p>
  
  <p>I need to move from Activity to fragment class</p>
  
  <p>Here is my Activity class</p>
  
  <pre><code>Intent notificationIntent = new Intent(context,MessagesFragment.class);
  </code></pre>
  
  <p>And the Fragment class is like</p>
  
  <pre><code>public class MessagesFragment extends SherlockFragment implements
      OnItemClickListener {
  
  // Layout parameters declaration
  private PullToRefreshListView lv_messages;
  private ImageView iv_no_data;
  private LinearLayout ll_bg;
  
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
          Bundle savedInstanceState) {
      getSherlockActivity().getSupportActionBar().setDisplayOptions(
              ActionBar.DISPLAY_SHOW_CUSTOM);
      getSherlockActivity().getSupportActionBar().setDisplayHomeAsUpEnabled(
              true);
      getSherlockActivity().getSupportActionBar().setHomeButtonEnabled(true);
      getSherlockActivity().getSupportActionBar().setDisplayShowHomeEnabled(
              true);
      getSherlockActivity().getSupportActionBar().setCustomView(
              R.layout.header);
      getSherlockActivity().getSupportActionBar().setBackgroundDrawable(
              new ColorDrawable(Color.parseColor("#009fe3")));
      TextView txt = (TextView) getActivity().findViewById(
              R.id.tv_title_header);
      Typeface font = Typeface.createFromAsset(getActivity().getAssets(),
              "georgia.ttf");
      txt.setText("MESSAGES");
      txt.setTypeface(font);
      return inflater.inflate(R.layout.listview_refreshable, null);
  }
  
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setHasOptionsMenu(true);
  }
  .
  .
  .
  .
  }
  </code></pre>
  
  <p>If I use <code>switchfragment</code> method it shows lots of errors in <code>FragmentChangeActivity</code></p>
  
  <pre><code>private void switchFragment(Fragment fragment) {
      if (getActivity() == null)
          return;
  
      if (getActivity() instanceof FragmentChangeActivity) {
          FragmentChangeActivity fca = (FragmentChangeActivity) getActivity();
          fca.switchContent(fragment);
  
      }
  }
  </code></pre>