Driver.findElementByXPath method does use the argument but only the parameter

since I do not want to dupilcte my code, I just want to encapuslate the part as a method which with 3 string arguments.
but will get the reported error that the third argument–“resourceText” was not found in the server.

I have used the isVisible(“jhs”,“jhsText”,“Jabra Halo Smart”), but the parameter–>“resourceText” was not replicated by the argument–>“Jabra Halo Smart”.

did anyone know if I could do it by this way?

/*
* This Method is to check headSet link by provided
* @param headsetText is the headSet name from the ListView
* @param comparationText is standard correct Text
* @param resourceText is the text attribute from the UIautomator
*
*/
public boolean isVisible(String headsetText, String comparationText, String resourceText){
headsetText = driver.findElementByXPath("//android.widget.TextView[contains(@text,‘resourceText’)]").getText();
comparationText = “resourceText”;
return comparationText.equals(headsetText);

}