android - 无法在相机应用程序中导入 android.os.SystemProperties

标签 android

在 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/

相关文章:

android - 未使用工具栏的自定义文本颜色

android - 如何将缩略图保存为 JPEG 文件?

java - 在模拟器/手机中运行应用程序时出现 NoClassDefFoundError [更新到上一个问题]

java.io.FileNotFoundException :/mnt/sdcard/file (Permission denied)

Android - 通知 BigPictureStyle

android - 将数据从一个 Activity 传递到另一个 Activity

android - 如何在 android 中绘制到 Canvas 的多个图像之间旋转特定图像?

Android on Drawer Closed Listener

java - Google AdMob AdView 始终为空

java - 从没有附加变量的 fragment 获取数据