I have an activity displaying some text, for example "someText".
From this activity, I open an alert dialog box as follow:
AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
builder.setTitle("Title");
String[] items = {"Hello", "World", "someText"};
builder.setItems(items, new MultiChoiceEventOnClickListener(...);
builder.setCancelable(true);
builder.show();
And here is my Robotium test:
solo.clickOnButton(...); // to open the dialog alert
solo.waitForDialogToOpen();
solo.clickOnText("someText");
The problem is that Robotium finds the text in the activity under the alert dialog. As "someText" can be anywhere in my activity, I cannot use an index.
How can I narrow the search of the text to the alertDialog
only?
or
How can I find the view item in the list of items in the alert dialog?