Starting Activity from Fragment causes NullPointerException

后端 未结 4 1161
醉话见心
醉话见心 2020-11-28 02:39

I\'m stuck here with a problem starting an activity from a Button inside a Fragment. Here is my code:

ViewPagerAdapter.java

import j         


        
4条回答
  •  星月不相逢
    2020-11-28 02:58

    According to a post here, you should be using FragmentStatePagerAdapter rather than FragmentPagerAdapter. I had the same problem you described, and making that switch worked for me.

提交回复
热议问题