title: Android SeekBar: Changing the value
body: <p>I am writing a block of code where I am programmatically creating a <code>SeekBar</code> to capture a percentage. The percentage is then displayed in a <code>TextView</code>. I have written the code to display both on screen:</p>
  
  <pre><code>public static void pebbleTypeHandler(LinearLayout layout, final TaskSwitcherTask task, PData value)
  {
      // Create an android seek bar to allow thumb drag
      // Have a text view to display the value
      Log.v(PebbleTypeHandlerPercentage.class.toString(), "-----&gt; Percentage");
  
      SeekBar seekbar = new SeekBar(task.getParent());
      TextView textView = new TextView(task.getParent());
      textView.setTextColor(ColorStateList.valueOf(0xFFFFFFFF));
      textView.setText(((PPercentage) value).getValue() + "%");
  
      layout.addView(textView);
      layout.addView(seekbar);
  
      int id = UtilityMethods.getNextId();
      value.getMeta().getDataPebble().setId(id);
      textView.setId(id);
      id = UtilityMethods.getNextId();
      seekbar.setId(id);
  
      Log.v(PebbleTypeHandlerLevel.class.toString(), "-----&gt; TextView ID: " + textView.getId());
      Log.v(PebbleTypeHandlerLevel.class.toString(), "-----&gt; SeekBar ID: " + seekbar.getId());
  }
  </code></pre>
  
  <p>How can I handle the <code>SeekBar</code> change. I want the <code>TextView</code> value to change depending on the thumb position. The maximum percentage is 100% and the minimum is 0%.</p>
  
  <p>I would also like to set an <code>onClickListener</code> on the <code>TextView</code> and update the position of the <code>SeekBar</code> based on the entered value to allow for more accurate values to be entered. The value in my data carrier, called Pebble, is a float as I would like to allow <code>Float</code> numbers.</p>
  
  <p>Any help would be appreciated.</p>
  
  <p>Regards,</p>
  
  <p>Owen</p>