Replacing 9-patch resources?

BBRecon

Senior Member
May 2, 2016
93
35
0
I can't seem to be able to replace a 9-patch resource in another app. I'm using the standard code. The other apps resource is in the drawable-xhdpi folder, mine also is in that same folder in my apps resources. They're both 9-patch files. I don't seem to be getting any errors, but it didn't replace when I looked in the app.

Code:
    @Override
    public void initZygote(StartupParam startupParam) throws Throwable {
        MODULE_PATH = startupParam.modulePath;
    }

    @Override
    public void handleInitPackageResources(XC_InitPackageResources.InitPackageResourcesParam resparam) throws Throwable {
        if (!resparam.packageName.equals("com.example.package"))
            return;

        XModuleResources modRes = XModuleResources.createInstance(MODULE_PATH, resparam.res);

        resparam.res.setReplacement("com.example.package", "drawable", "chat_send_bubble_bg", modRes.fwd(R.drawable.bubble));
    }
 
  • Like
Reactions: Dedi indonesia