I make my custom tablayout view to customize font for tablayout android but it give me crash on mTabs.add(position, tab); what is wrong with my code?
@Override
public void addTab(@NonNull Tab tab, int position, boolean setSelected) {
MyTextView myTextView = (MyTextView)
View.inflate(getContext(), R.layout.tab_item_template, null);
myTextView.setText(tab.getText());
tab.setCustomView(myTextView);
mTabs.add(position, tab);
super.addTab(tab, position, setSelected);
}
the error is
java.lang.IndexOutOfBoundsException: Invalid index 10, size is 0