必需:找到android.support.v4.app.Fragment:com.marketing.auratek.chatapp.RequestsFragment

时间:2017-07-14 03:50:14

标签: java android-studio

我正在制作聊天应用并创建了一个新包。我已粘贴下面的代码。 错误是: 需要:android.support.v4.app.Fragment

实测值:com.marketing.auratek.chatapp.RequestsFragmentcom.marketing.auratek.chatap

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

/**
 * Created by Jagan on 7/14/2017.
 */

class SectionsPagerAdapter extends FragmentPagerAdapter {
    public SectionsPagerAdapter(FragmentManager fm) {
        super(fm);
    }

    @Override
    public Fragment getItem(int position) {

        switch (position){

            case 0:
                RequestsFragment requestsFragment = new RequestsFragment();
                return requestsFragment;

            case 1:
                ChatsFragment chatsFragment = new ChatsFragment();
                return chatsFragment;

            case 2:
                FriendsFragment friendsFragment = new FriendsFragment();
                return friendsFragment;
        }
        return null;
    }

    @Override
    public int getCount() {
        return 3;
    }
}

0 个答案:

没有答案