android - Fragment callback on attach complete in Activity -


is possible attach complete of fragment in hosting activity? new android.

here code add fragment:

        fragmentmanager fm = getsupportfragmentmanager();         fragmenttransaction ft = fm.begintransaction();         decorationfragment fragment = new decorationfragment();         ft.add(r.id.fragmentcontainer,fragment,"decoration_fragment");         ft.commit(); 

i have 2 objects in fragment. want handle click event in activity.

public view oncreateview(layoutinflater inflater, viewgroup container,                          bundle savedinstancestate) {     // inflate layout fragment     view rootview = inflater.inflate(r.layout.fragment_decoration, container, false);      mchangetextcolorbutton = (button) rootview.findviewbyid(r.id.changetextcolorbutton);     mcolorpallette = (linearlayout)rootview.findviewbyid(r.id.color_pallette_linearview);     return rootview; } 

how achieve this?

not sure you're asking, perhaps you're looking for:

https://developer.android.com/reference/android/support/v4/app/fragmentactivity.html#onattachfragment(android.support.v4.app.fragment)

void onattachfragment (fragment fragment)

called when fragment attached activity.

this called after attached fragment's onattach , before attached fragment's oncreate if fragment has not yet had previous call oncreate.


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -