Android SDK error: Trying instantiate a class that is not a fragment

后端 未结 3 1945
日久生厌
日久生厌 2021-02-07 10:14

I am hardly trying to create a simple application with a top menu and a changeable view below (by pressing the buttons in the menu fragment we change the view of the fragment be

3条回答
  •  名媛妹妹
    2021-02-07 10:35

    In my case it turned out, I was doing stuff in onCreate in the wrong order:

    setContentView(R.layout.activity_qr_code_scan);
    super.onCreate(savedInstanceState);
    

    instead of

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_qr_code_scan);
    

提交回复
热议问题