java - replace a fragment from fragment -


i have activityfragment 2 fragment can start fragement activityfragment using :

fragmenttransaction transaction = getsupportfragmentmanager()                 .begintransaction(); transaction.add(r.id.center_layout, new myfragment()); transaction.commit(); 

my problem when trying replace myfragment() other fragment in r.id.center_layout myfragment() class

i tried

fragmenttransaction transaction =this.getchildfragmentmanager()     .begintransaction(); transaction.add(r.id.center_layout, client_ajouter); transaction.commit(); 

but

no view found id 0x7f06000b (center_layout) fragment client_ajouter 

and thank you.

use getfragmentmanager() instead of getchildfragmentmanager(). also, if want replace fragment, should using replace method instead of add.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -