Code example for Resources

        WindowManager wm = (WindowManager)getContext().getSystemService(Context.WINDOW_SERVICE);
        Configuration config = new Configuration();
        config.orientation = key.orientation;
        Resources r = new Resources(assets, metrics, config);
        mResourcesTable.put(key, new SoftReference<Resources>(r));
        return r;
    private synchronized void deleteResourcesForTheme(String packageName) {
        // When a theme package is uninstalled, remove all cached 
        // resource packages with the theme's package name. 
        for (PackageKey key : mResourcesTable.keySet()) {
            if (packageName.equals(key.packageName)) {
Connect your IDE to all the code out there  Get Codota for Java