How to send, receive and store references to external Methods
<p>In a custom Class I'm trying to execute functions that are given externally via parameters.</p>

<p>It is important for me not to have to store any reference to parent classes or such, only the methods/functions to be called.</p>

<p>I tried sending a Method as a parameter but it isn't working.</p>

<pre><code>class A
    // var to store reference to external method
    private Method myMethodReference;  // (says error: never used)

    // the setter to store the reference to the external method
    public void setMethodReference(Method someMethod)
    {
        myMethodReference = someMethod;
    }

    public boolean someFunctionWithinMyClass()
    {
        // call the external method via my reference
        myMethodReference();  // (says error: The method myMethodReference() is undefined)
    }
</code></pre>

<hr>

<p>Also, when I try to set the reference to the method from the external class, it doesn't work:</p>

<pre><code>class B

    public void someFunction() { Log.i("la", "la" };

    instanceOfClassA.setMethodReference(someFunction); // (says error: variable someFunction not found)
</code></pre>

<hr>

<p>So even passing the reference doesn't work because Eclipse assumes someFunction is a variable that is not in the scope.</p>

<p>I hope this explains it better!</p>
