Settings.Global

Janice._.oooh·2021년 11월 24일
0

Android/Java

목록 보기
1/8
post-thumbnail
public static final class Settings.Global
extends Settings.NameValueTable

java.lang.Object
   ↳	android.provider.Settings.NameValueTable
 	   ↳	android.provider.Settings.Global

Settings 내부 클래스

  • Settings.Global : 사용자 계정에 관계없이 적용되는 설정
    Global system settings, containing preferences that always apply identically to all defined users.
  • Settings.Secure : 시스템 보안관련 설정
    Secure system settings, containing system preferences that applications can read but are not allowed to write.
  • Settings.System : 그 밖의 다양한 설정
    System settings, containing miscellaneous system preferences.

Public methods

  • static int getInt(ContentResolver cr, String name)
    static int getInt(ContentResolver cr, String name, int def)
    Convenience function for retrieving a single secure settings value as an integer.

  • static String getString(ContentResolver resolver, String name)
    Look up a name in the database.

  • static boolean putInt(ContentResolver cr, String name, int value)
    Convenience function for updating a single settings value as an integer.

  • static boolean putString(ContentResolver resolver, String name, String value)
    Store a name/value pair into the database.

// e.g.
final int value = Settings.Global.getInt(
	MenuProvider.getInstance().getContext().getContentResolver(),
    	Settings.Global.AIRPLANE_MODE_ON, 0);
// e.g.
Settings.Global.putInt(context.getContentResolver(),Settings.Global.ADB_ENABLED, 1);



Reference)

https://developer.android.com/reference/android/provider/Settings
https://developer.android.com/reference/android/provider/Settings.Global#summary

Icons made by Freepik from www.flaticon.com

0개의 댓글