I want to import my constants which are in package consts and in class Constants. There I have inside classes.
For example I want to use form Capability.DEVICE_NAME instead of Constants.Capability.DEVICE_NAME
public class Constants {
    public class Capability{
        public final static String DEVICE_NAME = "deviceName";
        public final static String PLATFORM_NAME = "platformName";
        public final static String PLATFORM_VERSION = "platformVersion";
        public final static String APP_PACKAGE = "appPackage";
        public final static String APP_ACTIVITY = "appActivity";
    }
}
It have to be in inside classes!
Thank in advance.
You will have to import your class like below
import packageName.Constants.Capability;
You can use as you want like below:
System.out.println(Capability.DEVICE_NAME);  
Or You can make your class static and import as below.
import static com.Constants.*;
This import packagename.Constants.*; should work.
Or you can make the nested class static
public class Constants {
    public static class Capability{
        public final static String DEVICE_NAME = "deviceName";
        public final static String PLATFORM_NAME = "platformName";
        public final static String PLATFORM_VERSION = "platformVersion";
        public final static String APP_PACKAGE = "appPackage";
        public final static String APP_ACTIVITY = "appActivity";
    }
}
and import static:
import static packagename.Constants.*;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With