1. Android Central Question's Avatar
    Hi guys,

    I use Java and Android Studio for developing apps. I use them since a while but I have still a doubt about the Android Events Mechanism and the way parameters required by the event handlers arrive to them. The event handlers are methods, more specifically callbacks, and can receive parameters. Usually, when you call a method that requires parameters you have to pass them to it but, in the case of event handlers, it seems that something obscure happens because the parameters are passed “automatically” to the callback. I tried to find explanations on Internet and books but with no results. For example, the View type parameter required by the onClick event handler, how is it passed? from where? I perfectly know that this parameter represents the object on which I have clicked but I want to know when and where the passing happens.
    Another example: the onLocationChanged callback requires an input parameter of type Location... blah blah blah
    Could you please explain in a clear and detailed way how the mechanism works? How this “automatic” parameter passage works? If I would to create a custom callback that works in this way, how could I accomplish this?

    Thanks
    F
    07-07-2018 03:46 AM
  2. belodion's Avatar
    Would you like me to move this to our Developers Lounge forum?
    ManiacJoe likes this.
    07-07-2018 06:14 AM

Similar Threads

  1. how to remove account action required on my android phone
    By Android Central Question in forum Ask a Question
    Replies: 1
    Last Post: 07-07-2018, 05:01 PM
  2. Replies: 1
    Last Post: 07-07-2018, 11:06 AM
  3. Why is my wife not able to receive my text messages
    By Android Central Question in forum Ask a Question
    Replies: 2
    Last Post: 07-07-2018, 08:20 AM
  4. How to remove photos that was sent accidentally
    By Android Central Question in forum Ask a Question
    Replies: 1
    Last Post: 07-07-2018, 03:14 AM
LINK TO POST COPIED TO CLIPBOARD