How Can I Transfer Event From One Child To Another Child If They Are From Same Viewgroup In Android?
So far I was able to transfer the event from the parent (viewgroup) to the child. ie When I click child 1, the viewgroup sends the event to child 1 and when I click child 2 (which
Solution 1:
Something like this : In main viewgroup
child2.setOnClickListener(new....{
and inside thisevent handler call an appropriate method in child1
child1.onSomethingInChild2()
Solution 2:
What i did was inside dispatchTouchEvent of child 2 I test for the state. If the the state is true I called child1.dispatchTouchEvent(event) and passed the event to child 1.
In child 2
public boolean dispatchTouchEvent(MotionEvent event) {
if(cond == true){
child1.dispatchTouchEvent(event);
returnfalse;
}
}
Post a Comment for "How Can I Transfer Event From One Child To Another Child If They Are From Same Viewgroup In Android?"