java.lang.ClassCastException on switching fragments
<pre><code>private void switchFragment(Fragment fragment) {
    if (getActivity() == null)
        return;

    ClassA pm = (ClassA) getActivity();
    pm.switchContent(fragment);
}
</code></pre>

<p>I am trying to <code>switch fragments</code> from ClassB, i am getting this exception when i try to do. I am trying to call the fragments of <code>Class A</code> Activity. </p>

<blockquote>
  <p>java.lang.ClassCastException: com.test.ClassB cannot be cast to
  com.test.ClassA</p>
</blockquote>
