How to call back from a function to a listener in android?
<p>OK, I have a login class like the snippet below</p>

<pre><code>public class LoginClass {

    public void login() {
        login.authorize(username,password); 
            //run activity specific code here
    }
</code></pre>

<p>}</p>

<p>This class is quite generic, but depending on which activity calls LoginClass.login(), I would like different actions to be performed.</p>

<p>I've seen some implementation where a function is passed into the class and this function is then run on completion. Can anyone give me a brief example on how to do this.</p>
