Reputation: 575
I want to check the type of a widget programmatically.
View v = tabHost.getTabWidget().getChildAt(i);
How do I check if v
is a RelativeLayout
or LinearLayout
?
Upvotes: 1
Views: 355
Reputation: 11408
View v = tabHost.getTabWidget().getChildAt(i);
if(v instanceof RelativeLayout) {
// RelativeLayout
} else if (v instanceof LinearLayout){
// LinearLayout
}
Although you probably should use findViewById()
to find the Widget
you want.
View v = tabHost.getTabWidget().findViewById(R.id.myLinearLayoutView);
Upvotes: 3