Starting Activity from Fragment causes NullPointerException

后端 未结 4 1159
醉话见心
醉话见心 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:49

    Quick fix is

    class MyFragment extends Fragment {
    
        @Override
        public void onSaveInstanceState(Bundle outState) {
            super.onSaveInstanceState(outState);
            setUserVisibleHint(true);
        }
    

    And wait for update in safe mode :)

提交回复
热议问题