Error incompatible types: android.app.FragmentManager cannot be converted to android.support.v4.app.FragmentManager

浪尽此生 提交于 2019-12-01 19:04:37
Sanket Shah

Change

import android.app.Fragment;
import android.app.FragmentManager;

to

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;

in every class. you are facing problems because in your Fragment creation class you are using support v4 fragment and in your MainActivity class you are inflating as a simple fragment.

You also need to change getFragmentManager() to getSupportFragmentManager(), and make sure they're extending a FragmentActivity class.

Hope it will help you.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!