android - How to replace fragment on default blank activity (with fragment)? -


i've got 4 files in layout (the 3 auto-generated , fragment) :

activity_main.xml

content_main.xml

fragment_main.xml

my_custom_fragment.xml

i've made new class holds fragment.

on main fragment i've made event call in order replace fragment.

getactivity().getsupportfragmentmanager() .begintransaction() .addtobackstack(null) .replace(r.id.fragment, new customfragment()) .commit();

then adds layout current 1 instead of replacing ...

the fragment trying replace created through <fragment> in xml. such fragment cannot removed or added dynamically.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -