简体   繁体   中英

Xposed - how to hook Date Class android

As you can see below to get date when we use this code

Date date = new Date();
System.out.print("Due date:", date);

now how can i change the date before displaying result ,as it is not using any method so how to hook something like above ?

is there any way we can hook this to change result with xpose hook module ?

Your assumption "it is not using any method" is simply wrong. Your sample code uses two "methods" that can be hooked by Xposed:

The first "method" is the Date() constructor. You can hook it using XposedHelpers.findAndHookConstructor(..) . In the afterHookedMethod(..) you could then modify the date object.

The second method is Date.toString() . It is a regular constructor and can be hooked like any other method.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM