tags:

views:

464

answers:

1

I am now working on changing android theme style at runtime,when the user select a theme resource,not only the current application,but also all the applications installed on the phone should be changed.For example,just like you change the system language in setting activity,then all the applications' language changed.I just can not figure out how android framework achieves this,anybody knows something about this?

While I tried to use PackageManager,just like this:

    PackageManager manager = getPackageManager();
    List<ApplicationInfo> apps = manager
            .getInstalledApplications(PackageManager.GET_META_DATA);

    for (ApplicationInfo app : apps) {
        app.theme=android.R.style.Theme_Light_NoTitleBar_Fullscreen;
    }

It won't work.Does the attribure "theme" in ApplicationInfo read-only?

Thank you in advance!

+1  A: 

I don't think it's a good idea to patch data of foreign apps. You wouldn't get derivated themes, newly installed apps must be detected, etc. You probably would need a rooted phone for such changes anyway, so why not overwrite the default theme resources like Metamorph and all those custom ROMs do it? Of course, best solution would be if Android would support customizable default themes in the first place.

M. Schenk