Android - onAttach(Context) not called for API 23

前端 未结 7 950
离开以前
离开以前 2020-12-08 05:46

I\'ve updated the SDK to the latest version (API 23) and the onAttach(Activity) method for fragment is deprecated. So instead of using that method, now I\'m usi

7条回答
  •  旧巷少年郎
    2020-12-08 06:31

    You should try using the Support library version of Fragment.

    You need to switch to import android.support.v4.app.Fragment; instead of import android.app.Fragment;. You'll also need to make sure you're using getSupportFragmentManager() instead of getFragmentManager().

提交回复
热议问题