本文介绍了SystemProperties.set不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的资料来源$ C ​​$ C设置SystemProperties以下code。

  SystemProperties.set(ro.csc.countryiso_ code,KoreaA);        字符串= COUNTRY1 SystemProperties.get(ro.csc.countryiso_ code);        Log.e(DEBUGA,国家1);
        SystemProperties.set(ro.csc.countryiso_ code,KoreaB);
        字符串COUNTRY2 = SystemProperties.get(ro.csc.countryiso_ code);        Log.e(DebugB,COUNTRY2);

`

为什么我没有得到第二个变化来SystemProperties?
但是在LogCat中调试我总是得到: -
- DEBUGA KoreaA
- DebugB KoreaA

难道只有一次,我们可以从我们的code设置SystemProperties,直到设备关闭并重新打开,将持续到永远?

由于我检查关闭我的设备,并在重新开机后更改: -

我在我的资料来源$ C ​​$ C设置SystemProperties以下code。

  SystemProperties.set(ro.csc.countryiso_ code,KoreaB);        字符串= COUNTRY1 SystemProperties.get(ro.csc.countryiso_ code);        Log.e(DEBUGA,国家1);
        SystemProperties.set(ro.csc.countryiso_ code,KoreaA);
        字符串COUNTRY2 = SystemProperties.get(ro.csc.countryiso_ code);        Log.e(DebugB,COUNTRY2);

而在LogCat中调试我总是得到: -
- DEBUGA KoreaB
- DebugB KoreaB


解决方案

  SystemProperties.set(ro.csc.countryiso_ code,KoreaA);

属性的名称以RO开头,表示这是一个只读属性,所以一旦设置,就无法再更改。

I have following code in my Source code to set SystemProperties.

        SystemProperties.set("ro.csc.countryiso_code","KoreaA");

        String country1 = SystemProperties.get("ro.csc.countryiso_code");

        Log.e("DebugA",country1);
        SystemProperties.set("ro.csc.countryiso_code","KoreaB");
        String country2 = SystemProperties.get("ro.csc.countryiso_code");

        Log.e("DebugB",country2);

`

Why am i not getting Second Change to SystemProperties?But in LogCat Debug I am always getting :-:- DebugA KoreaA:- DebugB KoreaAIs it only the once we can set SystemProperties from our Code and that will persist for ever until device is switched off and turned on again?

As i checked changing after switching off my device and turning it on again :-

I have following code in my Source code to set SystemProperties.

        SystemProperties.set("ro.csc.countryiso_code","KoreaB");

        String country1 = SystemProperties.get("ro.csc.countryiso_code");

        Log.e("DebugA",country1);
        SystemProperties.set("ro.csc.countryiso_code","KoreaA");
        String country2 = SystemProperties.get("ro.csc.countryiso_code");

        Log.e("DebugB",country2);

And in LogCat Debug I am always getting :-:- DebugA KoreaB:- DebugB KoreaB

解决方案
     SystemProperties.set("ro.csc.countryiso_code","KoreaA");

The name of the property starts with "ro", means it's a read-only property, so once set, you can't change it any more.

这篇关于SystemProperties.set不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-06 19:28