title: Android: How to check if two numbers in two clicked buttons are equal (memory game)?
body: <p>Can someone give me a tip how to check if two numbers are equal?
  I'm making memory game for practice. User clicks one button which shows one number, than he clicks another which shows second number.
  How to check if those two numbers are same, beacuse if they are same they need to stay vissible, and if they are not same, they need to be hidden again.</p>
  
  <p>My adapter:</p>
  
  <pre><code>package com.example.korisnik.assignment;
  
  import android.content.Context;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.BaseAdapter;
  import android.widget.Button;
  import android.widget.GridView;
  import java.util.ArrayList;
  import java.util.Collections;
  
  public class ButtonAdapter extends BaseAdapter {
  
  Button[] buttons;
  public Context c;
  
  public ButtonAdapter(Context c) {
      final ArrayList&lt;Integer&gt; numbers = new ArrayList&lt;Integer&gt;();
      for (int i=1; i&lt;=5; i++) {
          numbers.add(i);
      }
      for (int i=1; i&lt;=4; i++) {
          numbers.add(i);
      }
      Collections.shuffle(numbers);
      this.c = c;
      buttons = new Button[9];
      for(int i=0;i&lt;buttons.length;i++) {
          final int o = i;
          buttons[i] = new Button(c);
          buttons[i].setBackgroundResource(R.mipmap.block);
          buttons[i].setLayoutParams(new GridView.LayoutParams(300,300));
          buttons[i].setTag(0);
          buttons[i].setTextSize(20);
          buttons[i].setText("X");
          buttons[i].setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  Button btn = (Button) v;
                  btn.setText(String.valueOf(numbers.get(o)));
              }
          });
      }
  }
  
  @Override
  public int getCount() {
      return buttons.length;
  }
  
  @Override
  public Object getItem(int i) {
      return buttons[i];
  }
  
  @Override
  public long getItemId(int i) {
      return 0;
  }
  
  @Override
  public View getView(int i, View view, ViewGroup viewGroup) {
      return buttons[i];
  }
  }
  </code></pre>