android - Fragments - statically defined fragments cannot be replaced -
i'm studying fragments in android. read tutorial https://www.tutorialspoint.com/android/android_single_fragments.htm . in tutorial, 2 fragment , 1 activity(main activity) defined. 2 fragments added main activity statically in xml file.
in mainactivity class, 1 fragment's layout replaced root element of main activity invoking
fragmenttransaction.replace(android.r.id.content, ls_fragment);
however, in tutorial said :
you cannot replace fragment defined statically in layout file via fragmenttransaction.
if understand correctly, these 2 tutorials conflict, because statically defined fragments replaced in tutorialspoint's example , second tutorial says statically defined fragment cannot replaced.
Comments
Post a Comment