I am trying to learn fragment.I am clicking a fragment class and my app crashes.I have declared it in the manifest..But why it is happening..My Menu class
public
I think the problem is that you're Activity(Main Activity/ Activity that hosts the Fragments) doesn't extend the FragmentActivity class.
If you're using the Support Library for ActionBar, the just make sure your Activity class extends the ActionBarActivity class.
That's why your Fragments can't be cast into the Main Activity.(ClassCastException)
So it should be:
public class MainFragmentDemoActivity extends FragmentActivity .... {
or:
public class MainFragmentDemoActivity extends ActionBarActivity .... {
Open for correction, as always! Regards, Edward Quixote.