The official documentation contains misleading using of java syntax. There is redundant semicolon ";" at the end of overridden method of anonymous class. As a result it looks like there is a mix of invocation of method or creation a new one. It complicates a lot of understanding the code.