Incompatible types error with Fragments

后端 未结 1 782
慢半拍i
慢半拍i 2020-12-07 03:36

I\'m trying to add a fragment to my main activity. When I type fragment = new CrimeFragment(); I get an Incompatible types error.

I tried

1条回答
  •  庸人自扰
    2020-12-07 04:21

    In class OffenseFragment.java replace

    import android.app.Fragment;
    

    with

    import android.support.v4.app.Fragment;
    

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