Hi,I want to share the theme among all the projects in android,which
effect is like HTC skin.How can I implement this function? I study the
AssetManager. Can I add the resource.arc(which is like the framework-
res) to all the projects with AssetManager? I modify the
ActivityThread as the following code:add  assets.addAssetPath("/system/
app/ShareTheme.apk");

/**
     * Creates the top level Resources for applications with the given
compatibility info.
     *
     * @param resDir the resource directory.
     * @param compInfo the compability info. It will use the default
compatibility info when it's
     * null.
     */
    Resources getTopLevelResources(String resDir, CompatibilityInfo
compInfo) {
        synchronized (mPackages) {
            // Resources is app scale dependent.
            ResourcesKey key = new ResourcesKey(resDir,
compInfo.applicationScale);
            if (false) {
                Log.w(TAG, "getTopLevelResources: " + resDir + " / "
                        + compInfo.applicationScale);
            }
            WeakReference<Resources> wr = mActiveResources.get(key);
            Resources r = wr != null ? wr.get() : null;
            if (r != null && r.getAssets().isUpToDate()) {
                if (false) {
                    Log.w(TAG, "Returning cached resources " + r + " "
+ resDir
                            + ": appScale=" +
r.getCompatibilityInfo().applicationScale);
                }
                return r;
            }

            //if (r != null) {
            //    Log.w(TAG, "Throwing away out-of-date resources!!!!
"
            //            + r + " " + resDir);
            //}

            AssetManager assets = new AssetManager();
            if (assets.addAssetPath(resDir) == 0) {
                return null;
            }
             assets.addAssetPath("/system/app/ShareTheme.apk");//
===============>This line add by me!!
            //Log.i(TAG, "Resource: key=" + key + ", display metrics="
+ metrics);
            DisplayMetrics metrics = getDisplayMetricsLocked(false);
            r = new Resources(assets, metrics, getConfiguration(),
compInfo);
            if (false) {
                Log.i(TAG, "Created app resources " + resDir + " " + r
+ ": "
                        + r.getConfiguration() + " appScale="
                        + r.getCompatibilityInfo().applicationScale);
            }
            // XXX need to remove entries when weak references go away
            mActiveResources.put(key, new
WeakReference<Resources>(r));
            return r;
        }
    }

Who can help me or can give me some precious advice about it. Thank
you very much!!

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to