No view found for id 0x7f090005

后端 未结 2 1069
太阳男子
太阳男子 2021-01-23 23:39

I\'m starting to build a simple Android app so when I press my video button it calls a fragment which contains the video player, but I\'m always getting: No view found for id 0x

相关标签:
2条回答
  • 2021-01-24 00:20

    On ft.add() the int parameter refers to the container to which you want to add the Fragment; you are trying to add the Fragment to the Fragment's own layout (Android doesn't find the View because it is not inflated yet, if it did it will throw and Exception in this case; you cannot add a Fragment to its own layout). You want to replace R.id.fragmentVideo with R.id.activityStart to add the Fragment to the current TableLayout that is part of the already inflated main_activity layout

    0 讨论(0)
  • 2021-01-24 00:22

    Could you check whats the equivalent view for the id '0x7f090005' in the R.java file. It should be under gen folder of your project. The framework is not able to find this under the resource file that you have in this java class.

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