Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
正如您在下面看到的,当我们使用此代码时获取日期
Date date = new Date(); System.out.print("Due date:", date);
现在我如何在显示结果之前更改日期,因为它没有使用任何方法,所以如何挂钩上面的东西?
有什么方法可以用 xpose 钩子模块挂钩它来改变结果吗?
您的假设“它没有使用任何方法”是完全错误的。您的示例代码使用了两种可以被 Xposed 挂钩的“方法”:
第一个“方法”是Date()构造函数。您可以使用XposedHelpers.findAndHookConstructor(..). 然后您可以在其中afterHookedMethod(..)修改日期对象。
Date()
XposedHelpers.findAndHookConstructor(..)
afterHookedMethod(..)
第二种方法是Date.toString()。它是一个常规构造函数,可以像任何其他方法一样被挂钩。
Date.toString()