简体   繁体   English

Xposed 如何使用接口创建泛型类的实例

[英]Xposed How to Create Instance of Generic Class with Interface

the following code is from decompiler以下代码来自反编译器

package com.myapp.pk1

public class B {
    ... ...

    public interface a<T> {
        void onFailed(String str1, String str2) 

       void onSuccess(T v1);    

    }
}


package com.myapp.pk2

public class MyCustomClass {
  ... ...
}
... ...

package com.myapp.pk3

public class C {
     ... ...
    public static void d(boolean var0, B.a<MyCustomClass> var1){
    ... ...
    }
}


package com.myapp.pk3


public class AppClass {
   ... ...
    C.d(v1, new B.a<MyCustomClass>() {
    public void a(MyCustomClass v3) {
    ... ...
    }

    public void onFailed(String var1, String var2) {


    }
    ... ...
}

Here the instance of Ba is the callback of method Cd How can I reate an instance of that (interface?) with my own method of onSucces and onFailed?这里 Ba 的实例是方法 Cd 的回调我怎样才能用我自己的 onSucces 和 onFailed 方法创建一个(接口?)的实例?

Thnx a lot非常感谢

Sorry.对不起。 I just realized that the interface must be inplemented by the class that really works as callback.我刚刚意识到接口必须由真正用作回调的类来实现。 so I hooked that class and replace the method onFailed which has been implemented here.所以我钩住了那个类并替换了这里实现的方法 onFailed。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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