How to use OsConstants in a switch statement

Viewed 60

I have this code:

ErrnoException errno = (ErrnoException)lastException.getCause();
switch (errno.errno) {
    case OsConstants.EHOSTUNREACH:

        break;
}

but Android Studio gives me the error:

Error:(339, 21) error: constant expression required

but, OsConstants.EHOSTUNREACH is constant (from OsConstants.class):

public static final int EHOSTUNREACH = 0;

Update I downloaded the OsConstants java file and it gives me this (still I would assume something in OsConstants to be, well, constant):

public static final int EHOSTUNREACH = placeholder();
0 Answers
Related