在 camera.java 中,我需要在系统中获取属性。但是,我无法导入 android.os.SystemProperties,编译相机总是报错:
packages/apps/Camera/src/com/android/camera/Camera.java:53: cannot find symbol
symbol : class SystemProperties
location: package android.os
import android.os.SystemProperties;
在 camera.java 的开头,我包括:
import android.os.Message;
import android.os.MessageQueue;
import android.os.SystemClock;
import android.os.SystemProperties; /* (this is in line 53)*/
SystemProperties 似乎不在android.os 包中,但我查看了框架源代码,它确实在其中。
这发生在相机应用程序中。我以这种方式使用 SystemProperties 在 packages/app 目录下找到了许多应用程序。这真的很奇怪。
最佳答案
SystemProperties 类设置了“隐藏”注释。
所以你想在应用层使用这个类,
你必须使用反射。
SystemProperties 类的定义如下。
package android.os;
/**
* Gives access to the system properties store. The system properties
* store contains a list of string key-value pairs.
*
* {@hide}
*/
public class SystemProperties
关于android - 无法在相机应用程序中导入 android.os.SystemProperties,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7735172/