How to have multiple tag checks?
<p>So, I added two tags to all my buttons. First one I set like this:</p>

<pre><code>/ labelForButton and tagForButton


         class MyStruct {
           public MyStruct (String lab, String t){
            label = lab;
            tag = t;
        }
           private String label;
           private String tag;
           }

    mDbHelper.open();

                Cursor c = mDbHelper.getSpojnice(generateWhereClause());


                ArrayList&lt;MyStruct&gt; labelsA = new ArrayList&lt;MyStruct&gt;();
                ArrayList&lt;MyStruct&gt; labelsB = new ArrayList&lt;MyStruct&gt;();

                labelsA.add(new MyStruct(c.getString(2), "1")); // this tag should be the same to button that matches
                labelsB.add(new MyStruct(c.getString(3), "1"));
                labelsA.add(new MyStruct(c.getString(4), "2"));
                labelsB.add(new MyStruct(c.getString(5), "2"));
                labelsA.add(new MyStruct(c.getString(6), "3"));
                labelsB.add(new MyStruct(c.getString(7), "3"));
                labelsA.add(new MyStruct(c.getString(8), "4"));
                labelsB.add(new MyStruct(c.getString(9), "4"));
                labelsA.add(new MyStruct(c.getString(10), "5"));
                labelsB.add(new MyStruct(c.getString(11), "5"));
}
}
</code></pre>

<p>And then in strings.xml:</p>

<pre><code>&lt;item type="id" name="KOLONA1"/&gt;
&lt;item type="id" name="KOLONA2"/&gt;
</code></pre>

<p>and then:</p>

<pre><code>a1.setText(labelsA.get(0).label);
            a1.setTag(R.id.KOLONA1, labelsA.get(0).tag);
            a1.setOnClickListener(clickListener);
            b1.setText(labelsB.get(0).label);
            b1.setTag(R.id.KOLONA2, labelsB.get(0).tag);
            b1.setOnClickListener(clickListener);
            a2.setText(labelsA.get(1).label);
            a2.setTag(R.id.KOLONA1, labelsA.get(1).tag);
            a2.setOnClickListener(clickListener);
            b2.setText(labelsB.get(1).label);
            b2.setTag(R.id.KOLONA2, labelsB.get(1).tag);
            b2.setOnClickListener(clickListener);
            a3.setText(labelsA.get(2).label);
            a3.setTag(R.id.KOLONA1, labelsA.get(2).tag);
            a3.setOnClickListener(clickListener);
            b3.setText(labelsB.get(2).label);
            b3.setTag(R.id.KOLONA2, labelsB.get(2).tag);
            b3.setOnClickListener(clickListener);
</code></pre>

<p>Now, I have to check if first pressed button and the next one have the same R.id.KOLONA tag (either 1 or 2) and ONLY if they don't, to procced to next check. And the next check i pretty much wrapped up, maybe good, maybe not so good, but I think I will work. Here's the check code that should start if the LAST TWO pressed buttons don't have the same tag:</p>

<pre><code>final OnClickListener clickListener = new OnClickListener() {

            private Button buttonClicked;

            public void onClick(View v) {

                Button button = (Button) v;
                button.getBackground().setColorFilter(new LightingColorFilter(0xFFFFFFFF, 0x003333));

                if (buttonClicked == null) {
                    // first button is clicked
                    buttonClicked = button;
                    // second button is clicked
                        button.setOnClickListener(null);
                    if (buttonClicked.getTag().equals(button.getTag())) {
                        Toast.makeText(Spojnice.this, "Correct", Toast.LENGTH_SHORT).show();
                        button.getBackground().setColorFilter(new LightingColorFilter(0xFFFFFFFF, 0x66FF33));
                        buttonClicked.getBackground().setColorFilter(new LightingColorFilter(0xFFFFFFFF, 0x66FF33));
                        buttonClicked.setEnabled(false);
                        button.setEnabled(false);
                    } else {
                        Toast.makeText(Spojnice.this, "Wrong", Toast.LENGTH_SHORT).show();

                    }
                    buttonClicked = null;
                }       
            }

     };
</code></pre>

<p>How to implement check in the last snippet to check if the 1st clicked button and the 2nd clicked button have the same R.id.KOLONA tag? And then when the 3rd button is clicked, then to check if that button and the previously clicked 2nd button have the same tag, 4th with 3rd and so on. And only when we come to pair that don't have the same tag, to go on with my last snippet.</p>
