mardi 26 septembre 2017

Java - Define interface with reflection error

This always prints true. I did exactly what it says here http://ift.tt/2hwUAev. Why is mServiceConn null?

android.content.ServiceConnection mServiceConn = (android.content.ServiceConnection) java.lang.reflect.Proxy.newProxyInstance(
            ServiceConnection.class.getClassLoader(),
            new java.lang.Class[] { android.content.ServiceConnection.class },
            new java.lang.reflect.InvocationHandler() {

                @Override
                public Object invoke(Object proxy, java.lang.reflect.Method method, Object[] args) throws java.lang.Throwable {
                    log("methodName",method.getName());
                    return null;
                }
            });


log("isNull "+Boolean.toString(mServiceConn==null)); 





Aucun commentaire:

Enregistrer un commentaire