![]() ![]() i changed the fragment and function to androidx and it did work. i was using the old app compact library instead of androidx library. Here is my code : FragmentManager fragmentManager=getActivity().getFragmentManager() įragmentTransaction fragmentTransaction=fragmentManager.beginTransaction() įragmentTransaction.replace(R.id.profile_f, new UProfileFragment()) //My second Fragment | & | home_layout is frame layoutįragmentTransaction.addToBackStack(null) Īnd Here is my android studio screen error Screenshot :Įdit : Thank you for your answers this problem was due to androidx library and old android library's code mix up. ![]() Overview Guides Reference Samples Design & Quality. To dynamically add fragments to an existing layout you typically define a container in the XML layout file in which you add a fragment. Fragments can be dynamically modified by the transaction. Please can some one explain and solve this error in simpler way. Platform Android Studio Google Play Jetpack Kotlin Docs Games. Modify Fragment at run time The Fragment class and Fragment Transaction class allow you to add, remove and replace fragments in the layout of your activity. ![]() I also tired with this android fragment transaction doc but didn't understand. I tried as This answer and I google it everywhere done the same but not worked for me. I tried to open my second fragment from my 1st fragment but that giving me error. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |