android - onKeyDown inside custom viewPager that has been added through code in an activity -
there 1 activity in loading 1 layout , on click event adding viewpager calling addview(customviewpagerinstance)
customviewpagerinstance contains 3 separate type of custom views. want handle onkeydown
method separately each type of view , handle separately on activity itself.
i have implemented onkeydown()
in activity :
@overrride onkeydown(int keycode, keyevent event) { if(keycode==keyevent.keycode_back){ if(viewpageradded) return false; else //dobackbuttonprocessingofactivity return true; } else return false; }
and on 3 custom views :
@overrride onkeydown(int keycode, keyevent event) { if(keycode==keyevent.keycode_back){ { if(viewpageradded) //dobackbuttonprocessingofcustomview return true; else return false; } else return false; }
and setting setfocusable(true) , setfocusableintouchmode()
the in customview constructor still onkeydown()
of customview not triggered.
--any appreciated.