Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Listener inner class confusion  RSS feed

 
eric moon
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All!
I'm implementing a tree selection listener, and I want the anonymous inner class I created to call a method of the outer class. There's nothing in "getting in touch with your inner class" about calling methods of the outer class. When I try to call the method, the compiler complains that my inner class has no such method. What should I do?
Thanks!
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should be able to use inner classes to call methods in the outer class without using any special syntax. Could you post the code that is failing?
 
eric moon
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Bodie:
I found a workaround, but I was suspicious of the error message. I don't have the code that generated the error anymore, unfortunately. But I'm glad to know it's expected behavior. (I'd have sworn I'd done it before!)
Thanks!
e
 
eric moon
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've since done it numerous times, so I clearly misinterpreted the error. Thanks again!
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!