Closed GoogleCodeExporter closed 9 years ago
Please paste the test case.
Original comment by renasr...@gmail.com
on 7 Mar 2013 at 2:12
for(int i=0; i < list.getAdapter().getCount(); i++){
solo.clickOnView(getViewAtIndex(list, i, getInstrumentation()));
solo.assertCurrentActivity("DetailsActivity not found", "DetailsActivity");
Button fullDetails = (Button) solo.getCurrentActivity().findViewById(
R.id.btn);
solo.sleep(2000);
//solo.waitForView(fullDetails, 4000, true);
solo.clickOnView(fullDetails);
solo.goBack();
}
public View getViewAtIndex(final ListView listElement, final int indexInList,
Instrumentation instrumentation) {
ListView parent = listElement;
if (parent != null) {
if (indexInList <= parent.getAdapter().getCount()) {
scrollListTo(parent, indexInList, instrumentation);
int indexToUse = indexInList - parent.getFirstVisiblePosition();
return parent.getChildAt(indexToUse);
}
}
return null;
}
public <T extends AbsListView> void scrollListTo(final T listView,
final int index, Instrumentation instrumentation) {
instrumentation.runOnMainSync(new Runnable() {
@Override
public void run() {
listView.setSelection(index);
}
});
instrumentation.waitForIdleSync();
}
Original comment by raghav.mahajan000@gmail.com
on 7 Mar 2013 at 2:17
This is an issue with your code.
Instead of this:
Button fullDetails = (Button) solo.getCurrentActivity().findViewById(
R.id.btn);
Use
Button fullDetails = (Button) solo.getView)(
R.id.btn);
and use solo.scrollListToLine() instead of the method you have pasted.
Original comment by renasr...@gmail.com
on 7 Mar 2013 at 2:25
I changed it to what you said..but still not working.. it doesn't click button
after first time.
Original comment by raghav.mahajan000@gmail.com
on 7 Mar 2013 at 2:41
Original issue reported on code.google.com by
raghav.mahajan000@gmail.com
on 7 Mar 2013 at 1:48