@Override public String play(String action, String... args) { if (action.equalsIgnoreCase(AutomatorConstants.ACTION_SELECT)) { assertArgCount(action, args, 1); final TabHost tabs = this.getTabHost(); final String title = args[0]; AutomationManager.runOnUIThread( new Runnable() { public void run() { tabs.setCurrentTabByTag(title); } }); return null; } else if (action.equalsIgnoreCase(AutomatorConstants.ACTION_SELECT_INDEX)) { assertArgCount(action, args, 1); final TabHost tabs = this.getTabHost(); final int index = getIndexArg(action, args[0]); AutomationManager.runOnUIThread( new Runnable() { public void run() { tabs.setCurrentTab(index - 1); } }); return null; } return super.play(action, args); }
@Override public void onTabChanged(String tabId) { AutomationManager.recordTab(AutomatorConstants.ACTION_SELECT, tabId); }