我是android开发的新手,我正在通过SAX解析器解析xml文件并将解析的数据存储到字符串中。现在我需要在另一个类中使用该字符串,所以我需要知道如何在新类中调用该解析器。
提前致谢
我总是创建一个包含所有全局变量的类,并将其称为“Constants.java”
final public class Constants//final to prevent instantiation
{
public static final String SOME_STRING = "0.04";
public static final int SOME_NUMBER = 5;
public static final float METERS_PER_MILE = 1609.344f;
//private constructor to prevent instantiation/inheritance
private Constants()
{
}
}
要在代码中使用其中之一,请务必导入该类并使用:
常量.SOME_NUMBER
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)