I have listview which contains 20 button and at a time only 7 elements are visible. SO, to scroll the list, iam using the following code...
ListView list_messages = (ListView) solo.getView(android.R.id.list);
.
.
.
View viewAtPosition = getViewByPosition(j, list_messages);
.
public View getViewByPosition(int position, ListView listView)
{
final int firstListItemPosition = listView.getFirstVisiblePosition();
final int lastListItemPosition = firstListItemPosition + listView.getChildCount() - 1;
if (position < firstListItemPosition || position > lastListItemPosition) {
return listView.getAdapter().getView(position,
listView.getChildAt(position), listView);
} else {
final int childIndex = position - firstListItemPosition;
return listView.getChildAt(childIndex);
}
}
but the problem is , its able to click first 7 buttons but after that it is scrolling to the bottom and clicking last button 13 times.? any help..?