List fragment not appearing owing to No view found for ID error

前端 未结 1 1565
说谎
说谎 2021-01-26 12:51

I\'m trying to launch a list fragment but it only seems to be working on tablets. When I run my app on phones the app crashes. Does anyone know how to resolve this issue? Code a

相关标签:
1条回答
  • 2021-01-26 13:21

    it's because you have this line

    transaction.replace(R.id.master_container, newFragment);
    

    and you don't have any layout inside activity_main.xml that has the same id as master_container

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