1. 程式人生 > >Android中的android.provider.Settings.System系統屬性設定

Android中的android.provider.Settings.System系統屬性設定

Content Provider中的Setting.System表格記憶體儲了很多系統屬性的值,以鍵值對的形式存在!

可以對如下的變數進行設定

通過如下的函式可以對其進行讀寫:

static void (ContentResolver cr, Configuration outConfig)Convenience function to read all of the current configuration-related settings into a object.
static float (ContentResolver cr, String name, float def)Convenience function for retrieving a single system settings value as a floating point number.
static float (ContentResolver cr, String name)Convenience function for retrieving a single system settings value as a float.
static int (ContentResolver cr, String name)Convenience function for retrieving a single system settings value as an integer.
static int (ContentResolver cr, String name, int def)Convenience function for retrieving a single system settings value as an integer.
static long (ContentResolver cr, String name, long def)Convenience function for retrieving a single system settings value as a long.
static long (ContentResolver cr, String name)Convenience function for retrieving a single system settings value as a long.
synchronized static String
static Uri
(String name)Construct the content URI for a particular name/value pair, useful for monitoring changes with a ContentObserver.
static boolean (ContentResolver cr, Configuration config)Convenience function to write a batch of configuration-related settings from a object.
static boolean (ContentResolver cr, String name, float value)Convenience function for updating a single settings value as a floating point number.
static boolean (ContentResolver cr, String name, int value)Convenience function for updating a single settings value as an integer.
static boolean (ContentResolver cr, String name, long value)Convenience function for updating a single settings value as a long integer.
static boolean (ContentResolver resolver, String name, String value)Store a name/value pair into the database.

注意,應用程式中應加入: <uses-permission android:name="android.permission.WRITE_SETTINGS" />


相關推薦

Androidandroid.provider.Settings.System系統屬性設定

Content Provider中的Setting.System表格記憶體儲了很多系統屬性的值,以鍵值對的形式存在! 可以對如下的變數進行設定 通過如下的函式可以對其進行讀寫: static void (ContentResolver cr, Configurati

Android 4.4-5.0 系統狀態列顏色的修改。實現Translucent System Bar

在這裡我們使用一種簡單的方法,之前在網上也看過類似的實現方法,一種是直接在程式碼裡面去設定,還有一種直接修改主題的樣式,個人感覺後面一種比較方便,也容易理解,在這裡就介紹一下第二種方法。 首先要到AndroidManifest中為指定的Activity去設定Theme,不過我們不能在values/s

AndroidXposed框架篇---修改系統位置資訊實現自身隱藏功能

一、前言前文已經介紹了Xposed框架的基本使用規則,本文主要來介紹一個實際案例就是如何通過這個框架來修改系統的地理位置資訊來實現隱藏功能,在如今社交工具的發展特別是微信,他有一個實時位置共享功能,那麼

AndroidXposed框架篇-修改系統位置資訊實現自身隱藏功能

本文轉載自Android中Xposed框架篇—修改系統位置資訊實現自身隱藏功能 前文已經介紹了Xposed框架的基本使用規則,本文主要來介紹一個實際案例,就是如何通過這個框架來修改系統的地理位置資訊來實現隱藏功能。在如今社交工具的發展特別快,微信有一個實時位置

Android自動跳轉到系統設定介面

1.   ACTION_ACCESSIBILITY_SETTINGS :    // 跳轉系統的輔助功能介面            Intent intent =  new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS);              start

androidwebView 的基本使用與屬性總彙

為了使APP更加具有靈活性和可控制性,我們通常會在APP中內嵌運營人員可以自由切換的網頁。這時候我們就要用到一個神奇的控制元件webView。本篇文章由淺入深的詳細介紹webView 的使用與各項屬性,從最常用屬性到最不常用屬性依次進行了充分講解。(本文是由易到

Android常見的佈局檔案的屬性

android:background:設定控制元件或佈局檔案的背景,既可以是背景圖片,也可以是背景顏色android:layout_gravity:設定控制元件的對齊方式android:gravity

我的Android進階之旅------&gt;Androidandroid:windowSoftInputMode的使用方法

onf ecif 標簽 ear evel per another not 行為 面試題:怎樣在顯示某個Activity時馬上彈出軟鍵盤? 答案:在AndroidManifest.xml文件裏設置<activity>標簽的android:win

AndroidAlarmManager詳解以及利用PendingIntent設定鬧鐘

AlarmManager是提供一種訪問系統鬧鐘服務的方式,允許你去設定在將來的某個時間點去執行你的應用程式。當你的鬧鐘響起(時間到)時,在它上面註冊的一個意圖(Intent)將會被系統以廣播發出,然後自動啟動目標程式,如果它沒有正在執行。註冊的鬧鐘會被保留即使裝置處於休眠中

EditText---android EditText加入圖示 更改邊框顏色 設定透明 程式碼 .

main.xml [java] view plaincopyprint? <?xml version="1.0" encoding="utf-8"?>  <LinearLayout xmlns:android="http://schemas.an

Spring 如何向 Bean 注入系統屬性或環境變數

在 Spring 中為 javabean 注入屬性檔案中的屬性值一般人都知道的,可以通過 org.springframework.beans.factory.config.PropertyPlaceholderConfigurer 引入一個屬性檔案,然後給 bean 指定

Android通過訪問本地相簿或者相機設定使用者頭像

目前幾乎所有的APP在使用者註冊時都會有設定頭像的需求,大致分為三種情況: (1)通過獲取本地相簿的圖片,經過裁剪後作為頭像。 (2)通過啟動手機相機,現拍圖片然後裁剪作為頭像。 (3)在APP中新增一些自帶的頭像資源,供使用者選擇(不夠人性化,目前很少使用)。 這次我們簡

Android自定義View 自定義xml屬性設定

Android自定義View實現很簡單 繼承View,重寫建構函式、onDraw,(onMeasure)等函式。 如果自定義的View需要有自定義的屬性,需要在values下建立attrs.xml。在其中定義你的屬性。 在使用到自定義View的xml佈局檔案中需要加

利用makefile的語法功能,檢視AndroidAndroid.mk裡面的變數的值

$(warning  "/nthe value of BOARD_USE_PMEM_TO_SIMULATE_BMM $(BOARD_USE_PMEM_TO_SIMULATE_BMM)")ifeq ($(BOARD_USE_PMEM_TO_SIMULATE_BMM), true)LOCAL_SRC_FILES

ExtJsTextField與TextArea的只讀屬性設定

如果是TextField,動態設定只需要呼叫readOnly=true;或者是readOnly=false;就可以啦! var aa=new Ext.form.TextField({    name:'aa',    fieldLabel:'測試',    value:

System.getProperty 屬性設定

static final String SYS_FIELD_NORM_SETTING = xxSimilarity.class.getName() + ".lengthNormFactors"; String factors = System.getProperty(S

Androidsystem server程序啟動流程原始碼解析 系統服務啟動

system server 前言 System Server fork SystemServer SystemServer.main() SystemServer.createSystemContext SystemSe

Android M及更高版本使用 Settings.System 丟擲異常"You cannot keep your settings in the secure settings. "

最近專案需要從Android L遷移到Android M。在升級的過程中,遇到了如下的問題。  在專案中,有一些公共的資料是存放在存放在 系統資料庫SettingsProvider的System表中  在Android L中的使用方法是:  當需要寫資料時呼叫: Sett

Android應用儲存資料到系統資料庫(Settings.System.putString、Settings.System.putInt)

前言:在android應用開發的時候,有時候需要要儲存一些變數的值,有好幾種方法,這裡就介紹其中一種,儲存到系統資料庫中。 一、資料庫的位置在/data/data/com.android.provi

Android設置半個屏幕大小且居中的button布局 (layout_weight屬性)

ecc vra sgd oiv red ng2 cdc roi aligned 先看例如以下布局 : 上圖中。按鈕的大小為屏幕的一半,然後居中顯示在布局中央,每一個人心中都有自己的答案,看看我的方法吧,布局布局xml例如以下 : <?xml ver