zoukankan      html  css  js  c++  java
  • 主题切换时如何主动去刷新一些资源?

    近来不少同学在修改主题时遇到,切换主题,部分页面不更新的问题,下面来介绍一种切换主题时,主动刷新的方法:
        1、监听主题切换的广播
        private static final String DATA_TYPE_TMOBILE_STYLE = "vnd.tmobile.cursor.item/style";
        private static final String DATA_TYPE_TMOBILE_THEME = "vnd.tmobile.cursor.item/theme";
        private static final String ACTION_TMOBILE_THEME_CHANGED = "com.tmobile.intent.action.THEME_CHANGED";
    
        try {
            IntentFilter tMoFilter = new IntentFilter(ACTION_TMOBILE_THEME_CHANGED);
            tMoFilter.addDataType(DATA_TYPE_TMOBILE_THEME);
            tMoFilter.addDataType(DATA_TYPE_TMOBILE_STYLE);
            context.registerReceiver(mBroadcastReceiver, tMoFilter);
        } catch (android.content.IntentFilter.MalformedMimeTypeException e) {
            Log.e(TAG, "Could not set T-Mo mime types", e);
        }
        2、在广播中主动刷新资源
        private BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() {
            public void onReceive(Context context, Intent intent) {
                 if (ACTION_TMOBILE_THEME_CHANGED.equals(intent.getAction())) {
                    refreshRes();
                 }
            }
        }
  • 相关阅读:
    Day 38
    Day 37
    Day 36
    Day 35
    Day 34
    Day 33
    Day 32
    Day 31
    Day 30
    华为CE6180高级ACL配置
  • 原文地址:https://www.cnblogs.com/wjhblogs/p/4518162.html
Copyright © 2011-2022 走看看