What am i missing with this selector?

Hello guys… knowing this structure…

I wrote this selector to click the button based on the text:

public WebElement getItemWithText(String name) {
        return this.driver.findElement(AppiumBy.androidUIAutomator("new UiSelector().text(\"" + name + "\")"));
}

public void clickButton(String name) {
        getItemWithText(name)
                .findElement(AppiumBy.androidUIAutomator("new UiSelector().fromParent(new UiSelector().className(\"android.view.View\"))"))
                .findElement(AppiumBy.androidUIAutomator("new UiSelector().className(\"android.widget.Button\"))"))
                .click();
}

I take the element with the text then, i take the parent and inside that parent, i take the button. Then i click it.
But it seems to be a wrong selector… what did i miss?

it should be something like:

new UiSelector().text("your_text").fromParent(new UiSelector(). className("android.widget.Button"))

It works, thank you Aleksei!

But what if i need to split the logic like in the example above? I mean, can i use “driver.findElement” to concatenate selectors? Or in my case i must use a single string parameter?