listener - Android TabWidget detect click on current tab -
i trying find way able fire onclick event on tab when tab current tab.
i did try way (among several other) no success thou.
public void ontabchanged(string tabid) { log.d(this.getclass().getname(), ">>>>>>>>>>>>>>>>>>>>>>>> tabid: " + tabid); int tabs = gettabwidget().getchildcount(); log.d(this.getclass().getname(), "tabs: " + tabs); for(int i=0; i<tabs; i++){ view tab = gettabwidget().getchildat(i); if(i==tabhost.getcurrenttab()){ log.d(this.getclass().getname(), "tab: " + i); tab.setonclicklistener(this); }else{ tab.setonclicklistener(null); tab.getonfocuschangelistener(); } } }
the point set onclicklistener
null
so, next time click on tab nothing happens, have normal tab behavior.
any idea there outside?
after gothrough many solutions tab listener, have found simple solution...
gettabhost().setontabchangedlistener(new ontabchangelistener() { @override public void ontabchanged(string tabid) { int = gettabhost().getcurrenttab(); log.i("@@@@@@@@ ann click tab number", "------" + i); if (i == 0) { log.i("@@@@@@@@@@ inside onclick tab 0", "onclick tab"); } else if (i ==1) { log.i("@@@@@@@@@@ inside onclick tab 1", "onclick tab"); } } });
Comments
Post a Comment