Creating buttons and separating there functionality android
<p>my app have action bar on top of windows. Where are some buttons. Buttons count and there functions is changing depending on activity user are.</p>

<p>I want to write a class with methods <strong>addFirstButton</strong>, <strong>removeFirstButton</strong> and so on. 
So i other classes i want to do this:</p>

<pre><code>MyButtons myButtons = new MyButtons();    
myButtons.addFirstButton();
</code></pre>

<p>So there is everything alright, but how to create a listener button if i want to do this ?</p>

<p>Normally i would do this:</p>

<pre><code>    Button backButton = (Button) customNav.findViewById(R.id.back);     
    backButton.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                Toast.makeText(Action_Bar_TestingActivity.this, "BACK", Toast.LENGTH_SHORT).show();
            }
        });
</code></pre>

<p>But i want that this would be in <strong>MyButtons</strong> class and method somehow would return a listener to that action.</p>

<p>So any ideas if this possible ?</p>

<p>Thanks.</p>
