I wonder if it's possible to use a condition operator such as if for example to check if a button is visible or not. If so how can I implement it? I made a few attempts using is.Enable but I did not succeed.
I wonder if it's possible to use a condition operator such as if for example to check if a button is visible or not. If so how can I implement it? I made a few attempts using is.Enable but I did not succeed.
If it's visibility you need to test, you can use the % with% of View class . The method exists in class getVisibility
but as View
is derived from Button
, you can use it directly.
In the code it would look like this:
if (meuBotao.getVisibility() == View.VISIBLE) {
//código para quando está visivel
}
It has 3 states of visibility that you can test:
View
View.VISIBLE
View.INVISIBLE
Documentation for View class and Button class