title: Only 1 button enable in ListView, custom adapter
body: <p>I run into a problem where I need to enable my button in the ListView. The weird thing is : </p>
  
  <pre><code> public class CookingStepAdapter extends ArrayAdapter&lt;CookingStep&gt; {
  
  ...
         private void addButtonToList(Button clock, Button skip){
              if (list_clock_button == null) {
                  list_clock_button = new ArrayList&lt;Button&gt;();
                  iterate = 0;
              }
              if (list_skip_button == null)
                  list_skip_button = new ArrayList&lt;Button&gt;();
              list_clock_button.add(clock);
              list_skip_button.add(skip);
  
              clock.setEnabled(true);
              skip.setEnabled(true);
  
              list_clock_button.get(0).setEnabled(true);
              list_clock_button.get(0).setFocusable(true);
              list_clock_button.get(0).setFocusableInTouchMode(true);
              list_clock_button.get(0).invalidate();
  
              list_skip_button.get(0).setEnabled(true);
              list_skip_button.get(0).setFocusable(true);
              list_skip_button.get(0).setFocusableInTouchMode(true);
              list_skip_button.get(0).postInvalidate();
          }
  }
  </code></pre>
  
  <p>When I set enable with the <code>list_clock_button.get(0)</code>,  it's not working at all. But <code>clock.setEnabled(true);</code> actually worked. </p>
  
  <p>But then I only want the first button of the ListView enabled, that makes the first option more fit in this situation. The second option works, but it made all the buttons enabled, that's not what I want. I did recheck the first button address, and it matched <code>list_clock_button.get(0)</code>, why it's not working.</p>
  
  <p>EDIT :</p>
  
  <p>Here's my function getView :</p>
  
  <pre><code>@Override
      public View getView(int position, View convertView, ViewGroup parent) {
          LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
          View rowView = inflater.inflate(R.layout.cooking_steps_and_timer, parent, false);
  
          final Button button = (Button) rowView.findViewById(R.id.button_timer);
          final TextView timer = (TextView) rowView.findViewById(R.id.cooking_timer);
          final Button skipButton = (Button) rowView.findViewById(R.id.button_skip);
          TextView stepContent = (TextView) rowView.findViewById(R.id.cooking_step_content);
  
          final CookingStep step = list.get(position);
          String stepOrder = (String) context.getResources().getText(R.string.step_order) + " " + step.getOrder();
          String content = "&lt;b&gt;" + stepOrder + ":&lt;/b&gt;" + " " + step.getContent() + "\n";
          stepContent.setText(Html.fromHtml(content));
  
          if (step.getTimer() == null || step.getTimer() == 0){
              timer.setVisibility(View.GONE);
              button.setVisibility(View.GONE);
              skipButton.setVisibility(View.GONE);
          } else {
  
              //myTimer = new CookingTimer(step.getTimer());
              timer.setText(step.getMyTimer().toString());
              step.setCountDown(new CountDownTimer(step.getTimer() * 60000, 1000) {
                  @Override
                  public void onTick(long millisUntilFinished) {
                      step.getMyTimer().tick();
                      timer.setText(step.getMyTimer().toString());
                  }
  
                  @Override
                  public void onFinish() {
                      nextButtonEnable();
                  }
              });
  
              button.setText(R.string.button_available);
              skipButton.setText(R.string.skip_button_content);
  
              addButtonToList(button, skipButton);
              //button.setEnabled(true);
  
              list_clock_button.get(0).setEnabled(true);
  
              button.requestFocusFromTouch();
              button.setOnTouchListener(new View.OnTouchListener() {
                  @Override
                  public boolean onTouch(View v, MotionEvent event) {
                      if (event.getAction() == MotionEvent.ACTION_UP) {
  
                          if (!button.isPressed()) {
                              button.setPressed(true);
                              button.setText(R.string.button_available);
                              step.getCountDown().start();
                          } else {
                              button.setPressed(false);
                              button.setText(R.string.button_pressed);
                              step.getCountDown().cancel();
  
                          }
                      }
                      return true;
                  }
              });
  
              skipButton.setOnTouchListener(new View.OnTouchListener() {
                  @Override
                  public boolean onTouch(View v, MotionEvent event) {
                      if (event.getAction() == MotionEvent.ACTION_UP) {
                          step.getCountDown().cancel();
                          nextButtonEnable();
                      }
                      return true;
                  }
              });
          }
          return rowView;
      }
  </code></pre>