java - No view found for id ... for fragment (Android application) -
I'm struggling with the following error when I try to apply the slice layout. Here is the code
MainActivity ;.
PublicAction Extends MainActivity Activity {@Override Protected Zero OnCreate (bundled savedInstanceState) {super.onCreate (savedInstanceState); SetContentView (R.layout.activity_main); } Public Zero Show Fregon (see view) {Fragment Manager FM = Match-fragmentation (); Piece transaction FT = FM. BBT transactions (); Ft.edd (r.layout.frag_on, new freagon ()); FT.commit (); } }
When click on button ativity_main layout called showFragOne. Frag_one FragOne piece slice is the layout for the class;
public class FragOne extends Piece {@Override public view onCreateView (LayoutInflater inflater, ViewGroup container, bundle savedInstanceState) {// TODO Auto View Made method stub = inflater.inflate (R.layout .frag_one, container, incorrect); Return view; } }
Please help me solve this.
itemprop = "text"> The way you are calling add () is incorrect. The first parameter id is a of is ViewGroup that piece, no piece is going to host the layout of itself. For example FT.add (android.R.id.content, new frogon ());
Comments
Post a Comment