android.support.v4.app.FragmentTransaction required

前端 未结 6 1573
别跟我提以往
别跟我提以往 2021-02-05 03:54

entering in code like this:

FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();

comes up with this error \"androi

6条回答
  •  自闭症患者
    2021-02-05 04:44

    With getSupportFragmentManager() you are getting the supportLibrary fragmentManager instead of the systems fragmentManager. So you are working with a transaction of the supportlibrary.

    This is the reason why you need to add all these imports and use android.support.v4.app.

    If you want to get the systems fragmentManager just try to use getFragmentManager() instead getSupportFragmentManager().

    Hope this helps

提交回复
热议问题