Skip to content
Advertisement

How Do I Convert This Java Code to Kotlin libGDX

actor.addListener(new ChangeListener() {
    public void changed (ChangeEvent event, Actor actor) {
        System.out.println("Changed!");
    }
});

I can’t figure out how to convert the ChangeEvent handler code from Java to Kotlin

Advertisement

Answer

actor.addListener(object : ChangeListener() {
        fun changed(event: ChangeEvent?, actor: Actor?) {
            println("Changed!")
        }
    })
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement