i have TabHost app with Three Activities,in first tab i created a viewGroup.every thing working fine my proble开发者_如何学JAVAm is i want to get TabActivity instance from the view group's chaild Activity How can i get this... i am trying like this in View group's child activity
Tab_Activity TabObj = (Tab_Activity)getParent();
abObj.someMethod();
i got Class Cast Exception,i think i am getting View group Activity instance, i want to get TabActivity instance,please help me if any one knows answer
Tab_Activity TabObj = (Tab_Activity)getParent().getParent();
treid like this also... Thanx in Advance
I just tested it: if your TabActivity properly extends the standard android.app.TabActivity
then Tab_Activity TabObj = (Tab_Activity)getParent();
should work as designed.
EDIT: AH. You want to do something like this:
Tab_Activity TabObj = (Tab_Activity)((ChildActivity)getContext()).getParent();
from inside the ViewGroup.
精彩评论