private void selectListItem(final ListView l, int num, boolean longClick) { final int n = Math.min(l.getCount(), Math.max(1, num)) - 1; requestFocus(l); Log.i("nofatclips", "Swapping to listview item " + num); solo.sendKey(Solo.DOWN); getActivity() .runOnUiThread( new Runnable() { public void run() { l.setSelection(n); } }); sync(); if (n < l.getCount() / 2) { solo.sendKey(Solo.DOWN); solo.sendKey(Solo.UP); } else { solo.sendKey(Solo.UP); solo.sendKey(Solo.DOWN); } sync(); if (longClick) { longClick(l.getSelectedView()); } else { click(l.getSelectedView()); } }
private void swapTab(final TabHost t, int num) { final int n = Math.min(this.tabNum, Math.max(1, num)) - 1; Log.i("nofatclips", "Swapping to tab " + num); getActivity() .runOnUiThread( new Runnable() { public void run() { t.setCurrentTab(n); } }); sync(); }