利用ContentObserver获取系统时间制式12/24小时

Function 1

直接获取

 Settings.System.getInt(getContext().getContentResolver(), Settings.System.TIME_12_24, 0);

Function 2

利用数据库的回调

 // 注册监听
  getContext().getContentResolver().registerContentObserver(Settings.System.getUriFor(Settings.System.TIME_12_24), true, timeFormatObserver);
    
    private ContentObserver timeFormatObserver = new ContentObserver(new Handler()) {
        @Override
        public void onChange(boolean selfChange) {
//            super.onChange(selfChange);
            int timeFormat = Settings.System.getInt(getContext().getContentResolver(), Settings.System.TIME_12_24, 0);
            Log.d(TAG, "onChange: timeFormat:" + timeFormat);

            if ( 12 == timeFormat) {
                mTimeFormat = 12;
            } else if ( 24 == timeFormat) {
                mTimeFormat = 24;
            }
            setKernelTimeWithFormat(mNativeData, System.currentTimeMillis(), mTimeFormat);
        }
    };
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
MiTeC System Information Component Suite The most complex system information probe in Delphi and FPC/Lazarus world. The cost of a site license with full source codes is currently 110 EUR. TMiTeC_SystemInfo gathers all following components to one for simple use TMiTeC_AD explores ActiveDirectory TMiTeC_APM provides informaton about Advanced Power Management TMiTeC_BT detects Bluetooth devices using Native Bluetooth Enumerator) TMiTeC_CPU provides detailed CPU information TMiTeC_Devices provides devices information like Windows Device Manager TMiTeC_Disk provides logical drive information TMiTeC_Display provides display adapter information TMiTeC_DMA provides direct memory acceess TMiTeC_DriveContent scans and saves specified drive content TMiTeC_Engines provides information about various installed engines TMiTeC_EventLog digs information from Windows EventLog TMiTeC_Firewall enumerates settings and rules from Windows Firewall, rule management functionality TMiTeC_Machine provides informaton about computer or virtual machine, BIOS, TPM etc. TMiTeC_Media provides media devices information TMiTeC_Memory provides memory information TMiTeC_Monitor provides all connected moitors information TMiTeC_MSProduct detects some Microsoft products installed and their product keys TMiTeC_MUS detects available Windows updates (MicrosoftUpdateSession) TMiTeC_Network provides network card info, TCP/IP ad Winsock config, installed protocols, clients and services. TMiTeC_OperatingSystem provides OS detailed information, Locale, Timezone, NT specific info, hotfixes, internet settings etc. TMiTeC_Printers detects installed printers and their properties TMiTeC_ProcessList collects list of running processes, services, drivers and windows and their properties TMiTeC_Security detects installed AntiViruses, AntiSpyware and Firewalls TMiTeC_SMBIOS reads SMBIOS information from memory TMiTeC_Software provides list of installed software TMiTeC_Startup provides list of applications that are starte

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值