没有android.os.SystemProperties类??

csdeny 2009-11-13 03:45:22
我从网上找的几个程序都使用了这个类,可是我用的sdk1.6里没有这个类,怎么回事??
...全文
11694 23 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
23 条回复
切换为时间正序
请发表友善的回复…
发表回复
蜗牛 2012-07-20
  • 打赏
  • 举报
回复
求 Demo
longjing2008 2011-11-30
  • 打赏
  • 举报
回复
[Quote=引用 9 楼 freechinaren 的回复:]
问题已解决,现分享给大家:
把Android SDK 目录下data下的layoutlib.jar文件加到当前工程的附加库路径中,然后在源程序中Import 相应的包即可
如import android.os.SystemProperties;
[/Quote]

非常感谢,我的问题解决了,呵呵,赞一个。。。。
潜水的小懒猫 2011-11-03
  • 打赏
  • 举报
回复
真滴可以么?
c265n46 2011-09-28
  • 打赏
  • 举报
回复
我也碰到这个问题了。按照LZ的方法解决了。THKS
xqhrs232 2011-08-05
  • 打赏
  • 举报
回复
今天也遇到了这个问题,试试看!
challchampion 2011-07-04
  • 打赏
  • 举报
回复
留个爪
Huhood 2011-04-19
  • 打赏
  • 举报
回复
LZ的方式不可取,因为layoutlib.jar 相对来说比较大了,如果单单用SystemProperties类的,可以直接把源码拷出来。
MingLoveHui 2011-03-02
  • 打赏
  • 举报
回复
还是不懂怎么拿出来
gaogaf 2010-06-25
  • 打赏
  • 举报
回复
另外为什么这样就能使用了呢,仍然有@Hide阿
gaogaf 2010-06-25
  • 打赏
  • 举报
回复
很好,这个方法是怎么发现的呢?
zhuzii2001 2010-04-22
  • 打赏
  • 举报
回复
应该说得很清楚了吧. 例如:...\android-windows\platforms\android-2.1\data\layoutlib.jar
cancel_li 2010-03-30
  • 打赏
  • 举报
回复
[Quote=引用 9 楼 freechinaren 的回复:]
问题已解决,现分享给大家:
把Android SDK 目录下data下的layoutlib.jar文件加到当前工程的附加库路径中,然后在源程序中Import 相应的包即可
如import android.os.SystemProperties;
[/Quote]

加哪儿呀,路径具体在哪儿呀,详细说说啊
DrSmart 2010-01-11
  • 打赏
  • 举报
回复
你没有导入 import android.os.SystemProperties; 吧,使用ctrl+shift+o自动补全就行了
freechinaren 2009-12-16
  • 打赏
  • 举报
回复
问题已解决,现分享给大家:
把Android SDK 目录下data下的layoutlib.jar文件加到当前工程的附加库路径中,然后在源程序中Import 相应的包即可
如import android.os.SystemProperties;

chu2009 2009-12-12
  • 打赏
  • 举报
回复
\Android源代码\android-1.6_r1-donut-src\android\os

在这个里面的确是有的

我把它的源代码发给你吧
/*
* Copyright (C) 2006 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

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
{
public static final int PROP_NAME_MAX = 31;
public static final int PROP_VALUE_MAX = 91;

private static native String native_get(String key);
private static native String native_get(String key, String def);
private static native void native_set(String key, String def);

/**
* Get the value for the given key.
* @return an empty string if the key isn't found
* @throws IllegalArgumentException if the key exceeds 32 characters
*/
public static String get(String key) {
if (key.length() > PROP_NAME_MAX) {
throw new IllegalArgumentException("key.length > " + PROP_NAME_MAX);
}
return native_get(key);
}

/**
* Get the value for the given key.
* @return if the key isn't found, return def if it isn't null, or an empty string otherwise
* @throws IllegalArgumentException if the key exceeds 32 characters
*/
public static String get(String key, String def) {
if (key.length() > PROP_NAME_MAX) {
throw new IllegalArgumentException("key.length > " + PROP_NAME_MAX);
}
return native_get(key, def);
}

/**
* Get the value for the given key, and return as an integer.
* @param key the key to lookup
* @param def a default value to return
* @return the key parsed as an integer, or def if the key isn't found or
* cannot be parsed
* @throws IllegalArgumentException if the key exceeds 32 characters
*/
public static int getInt(String key, int def) {
try {
return Integer.parseInt(get(key));
} catch (NumberFormatException e) {
return def;
}
}

/**
* Get the value for the given key, and return as a long.
* @param key the key to lookup
* @param def a default value to return
* @return the key parsed as a long, or def if the key isn't found or
* cannot be parsed
* @throws IllegalArgumentException if the key exceeds 32 characters
*/
public static long getLong(String key, long def) {
try {
return Long.parseLong(get(key));
} catch (NumberFormatException e) {
return def;
}
}

/**
* Get the value for the given key, returned as a boolean.
* Values 'n', 'no', '0', 'false' or 'off' are considered false.
* Values 'y', 'yes', '1', 'true' or 'on' are considered true.
* (case insensitive).
* If the key does not exist, or has any other value, then the default
* result is returned.
* @param key the key to lookup
* @param def a default value to return
* @return the key parsed as a boolean, or def if the key isn't found or is
* not able to be parsed as a boolean.
* @throws IllegalArgumentException if the key exceeds 32 characters
*/
public static boolean getBoolean(String key, boolean def) {
String value = get(key);
// Deal with these quick cases first: not found, 0 and 1
if (value.equals("")) {
return def;
} else if (value.equals("0")) {
return false;
} else if (value.equals("1")) {
return true;
// now for slower (and hopefully less common) cases
} else if (value.equalsIgnoreCase("n") ||
value.equalsIgnoreCase("no") ||
value.equalsIgnoreCase("false") ||
value.equalsIgnoreCase("off")) {
return false;
} else if (value.equalsIgnoreCase("y") ||
value.equalsIgnoreCase("yes") ||
value.equalsIgnoreCase("true") ||
value.equalsIgnoreCase("on")) {
return true;
}
return def;
}

/**
* Set the value for the given key.
* @throws IllegalArgumentException if the key exceeds 32 characters
* @throws IllegalArgumentException if the value exceeds 92 characters
*/
public static void set(String key, String val) {
if (key.length() > PROP_NAME_MAX) {
throw new IllegalArgumentException("key.length > " + PROP_NAME_MAX);
}
if (val != null && val.length() > PROP_VALUE_MAX) {
throw new IllegalArgumentException("val.length > " +
PROP_VALUE_MAX);
}
native_set(key, val);
}
}
BTzjzxxx 2009-12-11
  • 打赏
  • 举报
回复
hoho,说错咯,是有这个类的,在framework\base\core\java下……
BTzjzxxx 2009-12-11
  • 打赏
  • 举报
回复
这是java的类,用于获得系统信息的,直接用就可以啊,如果出错,除非是调用语句错了,应该看下API
nihao38 2009-11-20
  • 打赏
  • 举报
回复
xuzysun 2009-11-14
  • 打赏
  • 举报
回复
版本不对。
yili_xie 2009-11-13
  • 打赏
  • 举报
回复
没有android.os.system这个类~~
SystemProperties是Java语言的类~~~ import java.lang.system 应该就可以了~~
这个类有没有权限限制我不太清楚~~你可以查查看
加载更多回复(1)

80,471

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧