I have a singleton object "MySingle", which in all classes I return as MySingle.createOrGetInstance();
Now the problem I am facing is that I would like to do some registration of methods and other things before calling the method in MySingle, so I looked at the Java class InvocationHandler Source Link
However, now the problem is how can I call the singleton method, because when I use the same code and instead of doing
DebugProxy.newInstance(new FooImpl());
I'm doing it
DebugProxy.newInstance(MySingle.createOrGetInstance()); But when I do this, I get a Cast Cast expression when I finish assigning the result to the `(MySingle sing) variable.
Im developing on Android, but I doubt that matters :).
Thanks Faisal abid
source share