title: Highlight TextView when clicked programmatically
body: <p>I dynamically generate TextViews which work like buttons. Now i want to highlight them when they get pressed. Something like change Text color or background color. 
  I have tried to use selector, but it doesn't work.</p>
  
  <pre><code>&lt;selector xmlns:android="http://schemas.android.com/apk/res/android"&gt;
  &lt;item android:state_focused="true" android:color="#ffffff"/&gt;
  &lt;item android:state_pressed="true" android:state_enabled="false" android:color="#ffffff" /&gt;
  &lt;/selector&gt;
  </code></pre>
  
  <p>Here my loop for creating the TextViews.</p>
  
  <pre><code>int z = 0;
      for (MOKGenericDataItem d : data) {
          if (d.getButtonText() != null) {
              final int pagePosition = z;
              TextView btn = new TextView(getActivity());
              btn.setId(z);
              final int id_ = btn.getId();
              btn.setText(d.getButtonText());
              btn.setTextSize(TypedValue.COMPLEX_UNIT_SP, 30);
              btn.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT, 1f));
              btn.setGravity(Gravity.CENTER);
  
              mLineareLayoutViewPagerButtons.addView(btn);
  
              btn1 = ((TextView) view.findViewById(id_));
              btn1.setOnClickListener(new View.OnClickListener() {
                  public void onClick(View view) {
                      mViewPager.setCurrentItem(pagePosition,false);
                  }
              });
          }
          z++;
      }
  </code></pre>