I have two questions related to the same issue that I cannot solve. I'm creating an appium programm to test a native android app. I'm using Java. 
Before the login, there's an option in the app to change the environment. I'm passing in my appium class the environment name as a parameter, and I'm using the Xpath to find the element corresponding to the provided environment.
Issue: it doesn't matter which environment name I'm passing as a parameter, every time it changes to the particular one (staging). 
Questions:

1. What could be the cause of it?
2. Why when I'm using the xpath with the text parameter, the appium cannot find the element despite the uiautomatorviewer tool has that text property.

selectEnv = androidDriver.findElement(By.xpath("//android.widget.LinearLayout[@text='QA']"));

I provided 2 screenshots. The first one is an actual app screen with the list of the environments and the properties from Android Studio Layout Inspector. 
[![enter image description here](https://i.stack.imgur.com/sMGlQ.png)](https://i.stack.imgur.com/sMGlQ.png)

The second one is the screenshot of uiautomatorviewer properties for one of the items from the list. 
[![enter image description here](https://i.stack.imgur.com/Ll8Tl.png)](https://i.stack.imgur.com/Ll8Tl.png)

```
new WebDriverWait(androidDriver, 30).until(ExpectedConditions.presenceOfElementLocated(id("md_contentRecyclerView")));
        envContainer = androidDriver.findElement(By.id("md_contentRecyclerView"));
        Assert.assertTrue(envContainer.isDisplayed());
        if (env.equals("dev")) {
            selectEnv = androidDriver.findElement(By.xpath("//android.widget.LinearLayout[@index='0']"));
            selectEnv.click();
        }
        if (env.equals("QA")) {
            selectEnv = androidDriver.findElement(By.xpath("//android.widget.LinearLayout[@index = '1']"));
            selectEnv.click();
        }
        if (env.equals("Staging")) {
            selectEnv = androidDriver.findElement(By.xpath("//android.widget.LinearLayout[@index='2']"));
            selectEnv.click();
        }
        if (env.equals("Prod")) {
            selectEnv = androidDriver.findElement(By.xpath("//android.widget.LinearLayout[@index='3']"));
            selectEnv.click();
        }

```