Type Type mismatch: cannot convert from RegisterFragment to Fragment

后端 未结 2 1906
心在旅途
心在旅途 2021-01-12 00:49

Here is my Code and The problem occurs in Switch Case....plz help

package com.example.atg.adapter;

import com.example.atg.LoginFragment;
import com         


        
相关标签:
2条回答
  • 2021-01-12 01:16

    The problem is that your RegisterFragment is a android.app.Fragment, but you are returning a android.support.v4.app.Fragment in your getItem(...) method. Check your import statements in both classes where you are importing Fragment and make sure they are either both importing the normal android.app.Fragment or the support library android.support.v4.app.Fragment depending on your application's needs.

    0 讨论(0)
  • 2021-01-12 01:16

    the problem is you are importing

    import android.app.Fragment;
    

    inside RegisterFragment and

    Importing

    import android.support.v4.app.Fragment;
    

    inside adapter.

    If you are using Support v4 import import android.support.v4.app.Fragment; in RegisterFragment as well.

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