title: Getting a Nullpointer at view.getTag
body: <p>I try to set the Tag with the ID of one of my buttons: </p>
  
  <pre><code>     int boeserzufall = (int) (Math.random()*23);
       Button boese = arr.get(boeserzufall);
       boese.setBackgroundResource(R.drawable.williboese);
       boese.setTag(R.drawable.williboese);
  </code></pre>
  
  <p>That works fine, <code>boese.getTag()</code> brings me the correct id. <code>arr</code> is an <code>ArrayList&lt;Button&gt;</code> that contains all my buttons.</p>
  
  <p>Now in my OnClick() method I want to check if the current button has the same resId as <code>boese</code></p>
  
  <pre><code>    b5.setOnClickListener(new View.OnClickListener() {
  
          @Override
          public void onClick(View arg0) {
              count++;
              int resId = (Integer) arg0.getTag();
              if(resId == R.drawable.williboese) {
                  Toast.makeText(MainActivity.this, "heeeee", Toast.LENGTH_SHORT).show();
              }
  
          }
      });
  </code></pre>
  
  <p>My problem is that I get a Nullpointer Exception when I try read <code>arg0.getTag()</code></p>
  
  <p><strong>Edit:</strong></p>
  
  <p>First, I take a random button out of my array and therefor I want to set the background image with <code>R.drawable.williboese</code>.
  So on one of my 25 buttons I have a different background image than on the others. This one I have to find and react different than on the others... </p>