Java hierarchy inside an android listner
<p>In my android application I want to solve the following scenario.</p>

<pre><code>class Login extends Activity {
   @Override
     public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
         LayoutBuilder  objLB=new LayoutBuilder(this);
         objLB.createSpinner();
    } 

    public void spinnerItemSelectedEvent(AdapterView&lt;?&gt; parent, View view,
        int pos, long id)
    {
    }
}



class LayoutBuilder {
    private Activity objActivity;

    public LayoutBuilder(Activity a) {
        objActivity = a; 
    }

    public void createSpinner() {
        final Spinner objSPItem = new Spinner(objActivity);
        objSPItem.setOnItemSelectedListener(
            new Spinner.OnItemSelectedListener() {
                public void onItemSelected(AdapterView&lt;?&gt; parent, View view,
                    int pos, long id)
                {
                    // Do some common activity 
                    objActivity.spinnerItemSelectedEvent(parent,view,pos,id);
                    // calling this for do some additional task
                }
                public void onNothingSelected(AdapterView&lt;?&gt; arg0) {}
        });
        objActivity.spinnerItemSelectedEvent()
    }
}
</code></pre>

<p>and the problem is when i try to access spinnerItemSelectedEvent(parent,view,pos,id) from  the 'onItemSelected' listner inside createSpinner method
 I got the following error.</p>

<p><strong>The method spinnerItemSelectedListener(AdapterView, View, int, long) is undefined for the type Activity</strong></p>

<p>but out side the listner the access to the method works ok(neglect parameter list). What is the reason behind that? is any alternate way exist for solving this? plz help </p>
