Appium 1.8.1 is unable to find the text and its intermittent

Hi All,

Appium is unable to verify the text and its intermittent.

Please find the error in the console:
java.lang.AssertionError: Failed in finding the text - Please create a 4 digit PIN.
at org.junit.Assert.fail(Assert.java:88)
at com.aa.qmo.ccmobile.pages.LoginPage.verifyPinScreenIsDisplayed(LoginPage.java:157)
at com.aa.qmo.ccmobile.steps.LoginSteps.verifyPinScreenIsDisplayedWithDefaultTexts(LoginSteps.java:108)
(reflection-invoke)
at org.jbehave.core.steps.StepCreator$ParametrisedStep.perform(StepCreator.java:782)
at org.jbehave.core.embedder.PerformableTree$FineSoFar.run(PerformableTree.java:350)

The java code:

if(!(driver.findElements(PIN_SCREEN).get(0).findElements(By.className(“android.view.View”)).get(10).getText().trim().equalsIgnoreCase("—"))){
checkStatusAndTakeScreenShot(“Failed in finding the text - Please create a 4 digit PIN.”);
fail(“Failed in finding the text - Please create a 4 digit PIN.”);
}

Where exactly i am going wrong ?