Should i declare the MainFragmentDemoActivity in manifest?

后端 未结 3 537
别那么骄傲
别那么骄傲 2021-01-28 10:34

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         


        
3条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-28 10:59

    Any Class that extends Activity in your application must be declared in the manifest, however, that does not appear to be your problem. Technically, this does answer your question though ;)

    This line:

    Caused by: java.lang.ClassCastException: com.example.practise.ListFragmentDemo cannot be cast to android.app.Fragment
    

    Does "ListFragmentDemo" extend Fragment?

提交回复
热议问题