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.
 

Latest News

What is the reason for your passion for sim racing?

  • Watching real motorsport

    Votes: 546 68.8%
  • Physics and mechanics

    Votes: 344 43.3%
  • Competition and adrenaline

    Votes: 363 45.7%
  • Practice for real racing

    Votes: 183 23.0%
  • Community and simracers

    Votes: 214 27.0%
Back
Top