More of a note to myself really. Anonymous classes in Java are subclasses. For whatever reason I’d led myself to believe that anonymous classes in Java are unnamed instances of classes, but they are not, they are subclasses.
this.getClass().getSimpleName() returns empty string for anonymous classes, but that doesn’t mean you can’t ever know the class name the anonymous class was created from. All you need to do is: this.getClass().getSuperclass().getSimpleName();
Note, you can find out if a class is an anonymous class by calling: this.getClass().isAnonymousClass();
this.getClass().getName() will return you the $ notation. eg: onClickListener$1
see http://stackoverflow.com/q/15202997/154272
Thank you, this answers perfectly to my problem.