Android OnTouch listener easy question
<p>Well, I have 16 buttons. I want to find an easier way to add them to an onTouch listener, I'm new to Android/java so I'm not sure what would work. Here's my pathetic code for that right now.</p>

<p><code>
public void onCreate(Bundle savedInstanceState) 
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);</p>

<pre><code>    Button btn_main1 = (Button) findViewById(R.id.cmd_main1);
    Button btn_main2 = (Button) findViewById(R.id.cmd_main2);
    Button btn_main3 = (Button) findViewById(R.id.cmd_main3);
    Button btn_main4 = (Button) findViewById(R.id.cmd_main4);
    Button btn_main5 = (Button) findViewById(R.id.cmd_main5);
    Button btn_main6 = (Button) findViewById(R.id.cmd_main6);
    Button btn_main7 = (Button) findViewById(R.id.cmd_main7);
    Button btn_main8 = (Button) findViewById(R.id.cmd_main8);
    Button btn_main9 = (Button) findViewById(R.id.cmd_main9);
    Button btn_main10 = (Button) findViewById(R.id.cmd_main10);
    Button btn_main11 = (Button) findViewById(R.id.cmd_main11);
    Button btn_main12 = (Button) findViewById(R.id.cmd_main12);
    Button btn_main13 = (Button) findViewById(R.id.cmd_main13);
    Button btn_main14 = (Button) findViewById(R.id.cmd_main14);
    Button btn_main15 = (Button) findViewById(R.id.cmd_main15);
    Button btn_main16 = (Button) findViewById(R.id.cmd_main16);


    btn_main1.setOnTouchListener(tListener1);
    btn_main2.setOnTouchListener(tListener1);
    btn_main3.setOnTouchListener(tListener1);
    btn_main4.setOnTouchListener(tListener1);
    btn_main5.setOnTouchListener(tListener1);
    btn_main6.setOnTouchListener(tListener1);
    btn_main7.setOnTouchListener(tListener1);
    btn_main8.setOnTouchListener(tListener1);
    btn_main9.setOnTouchListener(tListener1);
    btn_main10.setOnTouchListener(tListener1);
    btn_main11.setOnTouchListener(tListener1);
    btn_main12.setOnTouchListener(tListener1);
    btn_main13.setOnTouchListener(tListener1);
    btn_main14.setOnTouchListener(tListener1);
    btn_main15.setOnTouchListener(tListener1);
    btn_main16.setOnTouchListener(tListener1);
}
</code></pre>

<p></code></p>

<p>Obviously, that's a terrible way to do it. I'm sure there's a way to do some sort of loop, or put the buttons in an array or something. Any help shortening this up is greatly appreciated!</p>
