title: Setting selected value in editfield?
body: <p>I have made a custom auto suggest list.</p>
  
  <p>I want to set the selcted value in edit field.
  I am using this <a href="https://stackoverflow.com/questions/10855309/place-holder-text-on-a-autocompletefield-in-blackberry">Place holder text on a AutoCompleteField in blackberry</a></p>
  
  <p><strong>CustomAutoCompleteField.js</strong>
      package mypackage;</p>
  
  <pre><code>import net.rim.device.api.collection.util.BasicFilteredList;
  import net.rim.device.api.collection.util.BasicFilteredListResult;
  import net.rim.device.api.system.Application;
  import net.rim.device.api.ui.Color;
  import net.rim.device.api.ui.Graphics;
  import net.rim.device.api.ui.component.AutoCompleteField;
  import net.rim.device.api.ui.component.ListField;
  
  class CustomAutoCompleteField extends AutoCompleteField {
      private int yOffset = 0;
      private int xOffset = 0;
  
      public CustomAutoCompleteField(BasicFilteredList filteredList) {
         super(filteredList);
      }
  
      protected void paint(Graphics g) {
         super.paint(g);
         if (xOffset == 0) {
            // initialize text offsets once
            xOffset = getEditField().getContentLeft();
            yOffset = getEditField().getContentTop();
         }
         String text = getEditField().getText();
         if (text == null || text.length() == 0) {
            int oldColor = g.getColor();
            g.setColor(Color.GRAY);
            g.drawText("enter text", xOffset, yOffset);
            g.setColor(oldColor);
         }
      }
  
      public void onSelect(Object selection, int SELECT_TRACKWHEEL_CLICK) {
         ListField _list = getListField();
         if (_list.getSelectedIndex() &gt; -1) {
             final String selectedText = getEditField().getText();
           if(selectedText!=null){
               final BasicFilteredListResult result = (BasicFilteredListResult) selection;
               Application.getApplication().invokeLater(new Runnable() {
                    public void run() {
                       selectedText.setText(result._object.toString()); 
                    }
                  });
              // selectedText.setText(result._object.toString());
            }
         }
      }
      protected void sublayout(int maxWidth, int maxHeight) {
          // TODO Auto-generated method stub
          super.sublayout(250, 250);
      }
  
   }
  </code></pre>
  
  <p><strong>myscreen.js</strong></p>
  
  <pre><code>public final class MyScreen extends MainScreen
  {
      /**
       * Creates a new MyScreen object
       */
      public MyScreen()
      {        
          // Set the displayed title of the screen     
  
          BasicFilteredList filterList = new BasicFilteredList();
          String[] days = {"Monday(TAS)","Tuesday-(PAQ)","Wednesday-(MAN)",
                          "Thursday","Friday","Saturday","Sunday(I_)"};
          filterList.addDataSet(1,days,"days",BasicFilteredList.COMPARISON_IGNORE_CASE);
  
          HorizontalFieldManager hr =new HorizontalFieldManager();
          LabelField userName= new LabelField("hjsdhas");
          hr.add(userName);
          CustomAutoCompleteField autoCompleteField = new CustomAutoCompleteField(filterList);
  
          hr.add(autoCompleteField);
          add(hr);
  
      }
  }
  </code></pre>
  
  <p>CustomAutoCompleteField.java is my custom java class and I call the class from myscreen.java class</p>