Call public method on main activity
<p>My main class has a public method called commitChanges(). 
My layout contains extended EditTexts which can detect when the back button is pressed, as suggested here: <a href="http://stackoverflow.com/questions/5113437/android-get-back-key-event-on-edittext?answertab=votes#tab-top">Android - get back key event on EditText</a></p>

<p>Now, when a back button press is detected, I need to execute commitChanges, which stores the content to an array. commitChanges needs access the activity's listview however. </p>

<p>The question is: how to access the commitChange function of the main activity? I will need the instance of the main activity. Heres the code of the extended EditText:</p>

<pre><code>    public class BackText extends EditText{

private static final String TAG = "baby";
public BackText(Context context) {
    super(context);

}

public BackText(Context context, AttributeSet attrs) {
    super(context, attrs);
}

public BackText(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
}

@Override
public boolean onKeyPreIme(int keyCode, KeyEvent event) {
    if ((keyCode == KeyEvent.KEYCODE_BACK) &amp;&amp; 
        event.getAction() == KeyEvent.ACTION_UP) {
            Log.d(TAG,"keypad exit");
            commitChange(this);
            return false;
    }
    return super.dispatchKeyEvent(event);
}
</code></pre>

<p>}</p>

<p>Note i'm a beginner and this pretty advanced for me.
Note 2: this has nothing to do with services/multiple activities. The BackTexts are placed in the main activity.</p>
