“Activity not found” in Android

后端 未结 7 1500
后悔当初
后悔当初 2021-01-24 23:04

I am using the navigation-drawer template in eclipse to do a simple Android application. I have some trouble with fragment. I declared a fragment called PresenceL

7条回答
  •  自闭症患者
    2021-01-24 23:24

    You have created a Fragment so you could not call it like a Activity. You need to replace a container view, properly an FrameLayout with your Fragment.

    getSupportFragmentManager()
      .beginTransaction()
      .replace(R.id.content_frame, new PresenceLogFragment())
      .commit();
    

提交回复
热议问题