简体   繁体   中英

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?

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.

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