Apps ac.addOnClickedListener (AC Add On Clicked Listener) - How to use it?

Hello, I am trying to make AC app and cannot figure out how to make working button. I have the button itself, but it doesn't seem to be doing anything. I noticed that all app makers use ac.addOnClickedListener in their code so I was wondering what it is and how to use it. Oh yeah also its arguments.
 
It provides a callback function that the button then uses. Arguments are first the id of the button, then the callback. Look up event-driven programming to get an idea how this is done.

The callback function needs to have arguments matching the type of button it is. Although python also has the general purpose "*args" / "**kwargs" notation that absorbs any remaining arguments, so you may see those in code.
 

What are you racing on?

  • Racing rig

    Votes: 528 35.2%
  • Motion rig

    Votes: 43 2.9%
  • Pull-out-rig

    Votes: 54 3.6%
  • Wheel stand

    Votes: 191 12.7%
  • My desktop

    Votes: 618 41.2%
  • Something else

    Votes: 66 4.4%
Back
Top