红包请高手解决!!
Q Q 68832688
1. Hook 了 com.XxXx.Activity 在下面 想要获取到 com.AaAa.Kidn4f.Fragment 下的 TextView 和 String 变量值 也需要修改!
XposedHelpers.findAndHookMethod("com.XxXx.Activity",loadPackageParam.classLoader,"onCreate",Bundle.class,new XC_MethodHook()
{
@Override
protected void afterHookedMethod(final MethodHookParam param) throws Throwable
{
super.afterHookedMethod(param);
Class<?> Clazz = XposedHelpers.findClass("com.AaAa.Kidn4f.Fragment",loadPackageParam.classLoader);
Field Body = Clazz.getDeclaredField("g");
Body.setAccessible(true);
Object object = Clazz.newInstance();
TextView view = (TextView) Body.get(object); // 这里有错误! view = null
view.callOnClick();
////////////////////////////////////////////////////////
// 下面是 Xposed 内部写法 也不可以获取到
////////////////////////////////////////////////////////
Class<?> Clacc = XposedHelpers.findClass("com.AaAa.Kidn4f.Fragment",loadPackageParam.classLoader);
Field Bodu = XposedHelpers.findField(Clacc,"s");
Bodu.setAccessible(true);
Object objecu = Clacc.newInstance();
String Str = (String) Bodu.get(objecu);
/ 这里有错误!
XposedBridge.log( Str );
}
});
com.AaAa.Kidn4f.Fragment 代码
public class Fragment
{
public String s = "pass";
public TextView g;
}