How can I call a function in my main Activity class from a custom Gallery view in Android?
<p>I have a custom gallery view in which I am overriding some methods.  I would like to be able to call a function in my main activity from this class.  How do I make a reference back to my main class?</p>

<p>I thought I'd just push the class reference into CustomGallery by creating a setter function --->  g.setBaseClass(this);</p>

<pre><code>CustomGallery g = (CustomGallery) findViewById(R.id.playSelectionGallery);
g.setSpacing(10);
g.setCallbackDuringFling(false);
g.setAdapter(new ImageAdapter(this));
g.setSelection(1);
registerForContextMenu(g);
g.setBaseClass(this);
</code></pre>

<p>Problem is <strong>this</strong> is of type <strong>Context</strong> and <strong>someFunctionToCall()</strong> will result in a not a member of this class error.  In my custom class I have:</p>

<pre><code>public void setBaseClass(Context baseClass)
{
    _baseClass = baseClass;
}
private void callSomeFuntionOnMyMainActivityClass()
{
    _baseClass.someFunctionToCall();
}
</code></pre>

<p>All I want to do is call back to my main class, called ViewFlipperDemo.  This would be easy in As3.  Any thoughts?  Hopefully I'm missing something really simple.</p>
