Didn't find class “androidx.core.app.CoreComponentFactory”

前端 未结 10 1264
一向
一向 2020-12-03 06:40

I don\'t know what to do about the following errors, I\'ve searched the web but not found anything:

java.lang.ClassNotFoundException: Didn\'t find class \"an         


        
10条回答
  •  南方客
    南方客 (楼主)
    2020-12-03 07:01

    did u create fragments? ok if you create fragments with classes and after that you have to create a class to call those fragments. and if you use switch this cane be like this

    `public Fragment getItem(int i) {

        // you have create a switch to get positions using i.
        switch (i) {
            case 0:
                ChatsFragment chatsFragment = new ChatsFragment();
                return chatsFragment;
    
            case 1:
                GroupsFragment groupsFragment = new GroupsFragment();
                return groupsFragment;
    
            case 2:
                ContactsFragment contactsFragment = new ContactsFragment();
                return contactsFragment;
            default:
                return null;
        }
    
    }
    
    @Override
    public int getCount() {
        return 3;//error can be happen if u use default 0, use fragment counts in here.
    }`
    

    in this case you can see 3 cases in switch and the public int getCount() the return value should be 3 not default value 0.

    See your error must be close to this one. i got same kind of error and i solved it.

提交回复
热议问题