[Java] 纯文本查看 复制代码 public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button btn = findViewById(R.id.button);
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(MainActivity.this,GetString(),Toast.LENGTH_LONG).show();
}
});
}
public String GetString(){
return "你未被劫持";
}
}
//demo
[Java] 纯文本查看 复制代码 public class HookTest implements IXposedHookLoadPackage {
public void handleLoadPackage(XC_LoadPackage.LoadPackageParam loadPackageParam) throws Throwable {
if (loadPackageParam.packageName.equals("com.example.xposd_hook_new")) {
Class clazz = loadPackageParam.classLoader.loadClass("com.example.xposd_hook_new.MainActivity");
XposedHelpers.findAndHookMethod(clazz, "GetString", new XC_MethodHook() {
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
param.setResult("你已被劫持");
}
});
}
}
}
发现根本就没有调用到HookTest里面的afterHookedMethod
|