如何获取LicenceChecker的静态int标识符

时间:2018-07-11 03:40:27

标签: android string licensing android-lvl

在检查应用程序的许可以及 public void applicationError(int errorCode)方法返回一个int,比如说
public static final int ERROR_INVALID_PACKAGE_NAME = 1;

我想显示一条消息,显示int的“ ERROR_INVALID_PACKAGE_NAME”部分。 String error_Code = Integer.toString(errorCode);仅显示“ 1”。

如何从int获取字符串?

1 个答案:

答案 0 :(得分:2)

没有办法生成该值,编译器无法跟踪变量名。而这忽略了诸如proguard之类的故意破坏它们的东西。为此,您要么需要使用一个枚举而不是一个int,要么需要编写一个返回字符串的函数String convertErrorCodeToString(int errorCode)