如何导入android.os.SystemProperties [英] how to import android.os.SystemProperties

查看:938
本文介绍了如何导入android.os.SystemProperties的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图用

SystemProperties.get();

但无法导入 android.os.SystemProperties 包谷歌搜索位告诉我它的隐蔽性,是有解决办法吗?

but not able to import the android.os.SystemProperties package bit of googling tells me its hidden, is there any way around this ?

推荐答案

SystemProperties是一个隐藏的类,它仅适用于平台级code。你可以尝试通过反射来访问它,但不建议这样做。

SystemProperties is a hidden class that is only available to platform-level code. You could try to access it via reflection, but this is not recommended.

这是很容易Android的SystemProperties类做属性的旧式Java的方式混淆,即java.lang.System.getProperty()。注意,这是两种完全独立的系统。一个重要的区别是,在Java机制只在给定的过程中,而机器人SystemProperties可以跨过程

It is easy to confuse Android's SystemProperties class with the old-style Java way of doing properties, namely java.lang.System.getProperty(). Note that these are two totally separate systems. An important difference is that the Java mechanism works only within a given process, whereas the Android SystemProperties works across processes.

作为一个应用程序开发者,虽然你通常不会得到一个基于Java的API到Android的安卓SystemProperties,您可以使用检查SystemProperties在命令行

As an app developer, although you don't normally get a Java-based API into Android's Android SystemProperties, you can inspect the SystemProperties at the command-line using

adb shell getprop

这篇关于如何导入android.os.SystemProperties的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆