android - Use view pager from embedded fragment to change spinner in parent activity? -
i'm having bit of trouble communication between parentactivity , child fragment.
i using actionbarsherlock.
i have looked around on so, haven't found deals viewpagers , spinners yet.
background:
my child fragment has own action bar specifying couple of action items not available in other fragments, 1 of these action items spinner multiple options - a, b , c etc
by default mainactivity load fragment_a(child fragment) contains viewpager.
this view pager handles swipes between views , b(spinner has options a,b, c etc)
fragment_a has spinner adapter. if select on spinner, viewpager switches a, if select b on spinner, viewpager switches b. (this works fine).
my question is: how capture when user "swipes" between , b(they don't use spinner) , change "spinner" or b respectively?
note: pager adapter(for viewpager) created separately in different class.
any appreciated...thank all!
this need. you'll have set interface
in fragment
, implement interface
in parent activity. in fragment
instantiate instance of interface
, in whatever method use listen page changes, call method communicate data activity.
it seems kinda "hand-wavy" hope clears little.
Comments
Post a Comment