Remove All Ads from XDA

Replace method. Need help. PLease

734 posts
Thanks Meter: 857
By S0bes, Senior Member on 28th August 2014, 04:31 PM
Post Reply Subscribe to Thread Email Thread
Hi everyone. I ask for help. I literally beg for it..
You can see it here
I only want to replace method . Any of them.
For example I want this method returns FALSE every time it's called.
   public boolean isValidDialpadAlphabeticChar(char ch) {
       return (ch >= 'a' && ch <= 'z');
Here is my code
public class Fm implements IXposedHookLoadPackage {      
    public void handleLoadPackage(final LoadPackageParam loadpkg) throws Throwable { 
        if (loadpkg.packageName.equals("")) { 
            ClassLoader classLoader = loadpkg.classLoader; 
            XC_MethodReplacement methodreplacer = new XC_MethodReplacement() {  
                protected Object replaceHookedMethod( 
                        XC_MethodHook.MethodHookParam paramAnonymousMethodHookParam)
                        throws Throwable {
                	 XposedBridge.log("ALLLLL RIGHTTTT . NOW We ARE IN. AND MADE IT FALSe"); 
                    return false;  
            XposedHelpers.findAndHookMethod("", loadpkg.classLoader,
                    "isValidDialpadAlphabeticChar", Character.class, methodreplacer);
But this doesn't work
Here what I see in xposed log file:
java.lang.NoSuchMethodError: idDialpadAlphabeticChar(java.lang.Character)#exact
at ct(
at thod(
at thod(
at com.s0bes.fmspeaker.Fm.handleLoadPackage( 0)

BUUUT. If I will try to replace other method. For example
matchesCombination in (
Here the part of code which was changed:
XposedHelpers.findAndHookMethod("", loadpkg.classLoader,
                    "matchesCombination", String.class, String.class, ArrayList.class, methodreplacer);
Now everything work...
So, it works with one thing and doesnt work with method I need
30th August 2014, 02:38 PM |#2  
GermainZ's Avatar
Retired Forum Moderator / Recognized Developer / XDA Portal Team
Thanks Meter: 8,690
If you want to replace a method to return a consatnt, you can use the XC_MethodReplacement.returnConstant(…) shortcut. For example:
Select Code
XposedHelpers.findAndHookMethod("", loadpkg.classLoader,
                    "matchesCombination", String.class, String.class, ArrayList.class, XC_MethodReplacement.returnConstant(false));
As for your problem, you're trying to hook isValidDialpadAlphabeticChar(Character.class), but you should be hooking isValidDialpadAlphabeticChar(char.class). Just replace "Character.class" by "char.class" in your findAndHookMethod call.
The Following User Says Thank You to GermainZ For This Useful Post: [ View ] Gift GermainZ Ad-Free
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes