I have a fragment I am trying to add into a view.
FragmentManager fragMgr=getSupportFragmentManager(); feed_parser_activity content = (feed_parser_activity)f
I had this problem (when building my UI in code) and it was caused by my ViewPager (that showed Fragments) not having an ID set, so I simply used pager.setID(id) and then it worked.
ViewPager
Fragment
pager.setID(id)
This page helped me figure that out.