Search code examples
androidclassviewvisibleinvisible

getting the value of a constant in android class, Android


I am getting a compiler error in my class for the constant "VISIBLE" that I am trying to use in the following example

  if((enterIP.getVisibility()).equals(VISIBLE)){

the compiler error is, "VISIBLE cannot be resolved to a variable"

from the Android documentation

public int getVisibility()

Added in API level 1 Returns the visibility status for this view.

Related XML Attributes android:visibility Returns One of VISIBLE, INVISIBLE, or GONE.

how do I get the numerical value of VISIBLE or how can I use it in the example I showed?


Solution

  • VISIBLE alone is nothing so you are getting VISIBLE cannot be resolved to a variable.

    Just use View.VISIBLE to resolve it to that type.

    VISIBLE:

    int android.view.View.VISIBLE = 0 [0x0]
    
    public static final int VISIBLE