Cannot convert from android.support.v4.app.Fragment to android.app.Fragment

后端 未结 8 1547
南笙
南笙 2020-12-10 00:41

I\'m doing my first Android app, and wanted to get straight into the ICS API. I have so far created an app using an ActionBar, with swipeable tabs using Viewpager and Fragme

相关标签:
8条回答
  • 2020-12-10 01:14

    This solution works for me

    replace

    public class MyFragment extends Fragment{
    }
    

    with

    public class MyFragment extends android.support.v4.app.Fragment{
    }
    

    and also replace import

    import android.app.Fragment;
    

    with

    import android.support.v4.app.Fragment;
    
    0 讨论(0)
  • 2020-12-10 01:14

    I had the same problem. Solved it by changing the interface from implements ActionBar.TabListener to implements TabListener and then implement the methods inside this interface. Its also mentioned the error you have mentioned.

    0 讨论(0)
提交回复
热议问题