0

I have to build an app to hooking using Xposed some value from a static object but no success. This is the method I want to hook to the return value. in same to be return 10 or another value.

public static int somemethod () {
   return 0
}

What code can I use to hook this return value?

Update Question:

I want to change value of return to another value using xposed framework. In my example give value 0. And i want to change that value to 20 or 10 using xposed method. Anyway i want to know xposed methode to do that.

iZBasit
  • 1,314
  • 1
  • 15
  • 30
Newbieee
  • 1
  • 1
  • Actually, I think this is a dup of http://stackoverflow.com/questions/28947591/xposed-how-to-hook-the-private-static-method. The same techniques should be applicable to all static methods. – Stephen C Feb 19 '17 at 01:00
  • I want to change value of return to another value using xposed framework. In my example give value 0. And i want to change that value to 20 or 10 using xposed method. Anyway i want to know xposed methode to do that. – Newbieee Feb 19 '17 at 01:01
  • can you share your hook code and the error? – 4knahs Feb 20 '17 at 11:09

1 Answers1

1

Try something like this

XposedHelpers.findAndHookMethod("someClass",
            loadPkgParam.classLoader, "somemethod", new XC_MethodHook() {

                @Override
                protected void afterHookedMethod(MethodHookParam param)
                        throws Throwable {
                    param.setResult(neededResult);
                }

            });
legoscia
  • 39,593
  • 22
  • 116
  • 167