title: Onclick for imageview created in java, not xml
body: <p>Question
  I have created some <code>ImageViews</code> by code in android by in the <code>onCreate()</code> class
  The class implements the view.onclick()..<br>
  The <code>ImageView</code> doesn't register that it has been clicked. That's the problem
  should I use <code>setTag(1)</code> instead, how can I use tag in the <code>onClick()</code> ? :</p>
  
  <pre><code>a1 = new ImageView(this);
  a1.setImageResource(R.drawable.examplepicture);
  a1.setId(1);
  
  
  public void onClick(View v) {   
  
      switch (v.getId()) {
  
      case (1):
          Toast.makeText(ScrollView1.this, "id200", Toast.LENGTH_LONG).show();
          break;
      }
  }`
  </code></pre>