0

I've got a Lua function Button, which creates a button, add it to the layout and returns the button. Then I want to add to it ClickListener

local button = Button ("text", MATCH_PARENT, WRAP_CONTENT)
button: setOnClickListener (luajava.createProxy ("android.view.View.OnClickListener", {
         onClick = function (e)
             print ("clicked")
         end
     }
))

But the answer is just that:

Runtime error: java.lang.NoClassDefFoundError: android / view / View / OnClickListener
stack trackback:
[C]: in function 'createProxy'
...

P.S. Sorry for my english

1 Answer 1

1

"android.view.View.OnClickListener" should be "android.view.View$OnClickListener"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.