title: How to set delay in Android onClick function
body: <p>)
  I'm in a process of creating a memory game. My problem is that whenever i click for the second time, i can't even see toggled button. To be clear - first click toggles the togglebutton, so i can see the number it holds, the second click on a different togglebutton is suposed to toggle it, show me the number and then proceed to either set a score +1 if numbers are the same, or reverse them back again if they're different.</p>
  
  <p>Below is the code that i use as my onClick function, i've been thinking about putting some kind of sleep or delay function somwhere in the second "if block" - (if(klikniecia ==2)).</p>
  
  <p>Any help on this topic would be appreciated.</p>
  
  <pre><code>public void onClick(View view) {
  for (int i = 0; i &lt; karta.length; i++){
      if (view == karta[i]){
          karta[i].setEnabled(false);
          klikniecia++;
          if (klikniecia == 1){
              kartaID[0]=i;
              kartaWartosc[0]=listaKart.get(i);
  
          }
          if (klikniecia == 2){
              kartaID[1]=i;
              kartaWartosc[1]=listaKart.get(i);
  
              //i think, about setting a delay here, so i can see both of the cards, regardles if the're the same or not before reverting them.
  
              if (czyPara()){
                  karta[kartaID[0]].setEnabled(false);
                  karta[kartaID[1]].setEnabled(false);
                  klikniecia=0;
              }
              else{
  
                  karta[kartaID[0]].setEnabled(true);
                  karta[kartaID[0]].toggle();
                  karta[kartaID[1]].setEnabled(true);
                  karta[kartaID[1]].toggle();
                  klikniecia=0;
  
              }
          }
  
      }
  
  }
  </code></pre>
  
  <p>}</p>