I getting this error "Syntax error on token "}", delete this token." on the last line and I don't know why as I am new to Android.
public void ok() throws UiObjectNotFoundException{
//trying to find ok
try{
UiObject okDialog = new UiObject(new UiSelector().text("ok"));
if(okDialog.exists()){
System.out.println("Success");
break;//if ok exists it should come out
}
//if ok not exists
if(!okDialog.exists()){
System.out.println("retrying");
getUiDevice().pressHome();
UiObject enterButton = new UiObject(new UiSelector().text("enter"));
enterButton.clickAndWaitForNewWindow();
}
//validating again to check ok exists
if(okDialog.exists())
break;
else //if ok not exists again printing the belwo message
System.out.println("unable to find");
getUiDevice().pressHome();
//Here if ok not exists after going to home, i want to stop the whole script here..how to do this?
}catch (UiObjectNotFoundException e) {}
}
} Error message appears here : Syntax error on token "}", delete this token