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
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