title: How to use setOnClickListener and setOnTouchListener + for
body: <p>Why can not I use setOnClickListener and setOnTouchListener in my program?
  OnTouchListener works well, but I cen't run new activity?
  what am I doing wrong?</p>
  
  <pre><code>for (final ShopCategory category : gallery.getShopCategories()) {
              final Button button = new Button(this);
  </code></pre>
  
  <p>// ...  etc</p>
  
  <pre><code>button.setOnClickListener(new OnClickListener() {                   
                  @Override
                  public void onClick(View v) {
                      runNewActivity(gallery.getShops(), category);
                  }
              });
  
              button.setOnTouchListener(new OnTouchListener() {
  
                  @Override
                  public boolean onTouch(View v, MotionEvent event) {
                      if (event.getAction() == MotionEvent.ACTION_DOWN ) {
  
                          button.setTextColor(Color.parseColor("#333333"));
                          button.setBackgroundColor(Color.parseColor("#ffcc33"));             
                          return true;
                      } 
                       else if (event.getAction() == MotionEvent.ACTION_UP ) {
                           button.setTextColor(Color.WHITE);
                           button.setBackgroundColor(Color.parseColor("#333333"));                         
  
                       } 
  
  
                      return false;
                  }
              }); 
  categoriesButtonsLL.addView(button);
  </code></pre>