is there a way to get the View on the screen if it's visible or not giving the resource id for example if i have a button id in the xml is "@id/save"
passing "save" id can we get if the view is currently visible or not from any where in the app.
is there a way to get the View on the screen if it's visible or not giving the resource id for example if i have a button id in the xml is "@id/save"
passing "save" id can we get if the view is currently visible or not from any where in the app.
findViewById(R.id.save).isShown()
from any where in the app
Finding any view only makes sense for a single activity/fragment/dialog/ViewGroup. You can reuse the same view id across multiple screens to represent completely different view types.
I'm not sure it makes sense to know if a button is visible for a screen that doesn't have the view, so you'll need to add a null check to the above line.
If you want to put your button in some dialog box, then you would check if the dialog is present