title: URL Read CodeName One
body: <p>I'm relatively new to Codename One. I'm trying to read an URL and save the content on a String. I tried:</p>
  
  <pre><code>private String lectura = "";
  
  private String escritura = "";
  
  /*-------------------------------------------------------
   * Methods
   *-------------------------------------------------------
   */
  
  public Bulbs(int i, char rtype){
  
      type = rtype;
  
      number = i;
  
      status = readCNO(type, number);
  
  }
  
  public String giveStatus(){
      status = readCNO(type, number);
      return status;
  
  }
  
  
  public void turnBulbOn(){
  
      writeCNO('B', number, 1);
  
  }
  
  public void turnBulbOff(){
  
      writeCNO('B', number, 0);
  
  }
  
  public String readCNO(char type, int number){
  
  
      ConnectionRequest r = new ConnectionRequest();
      r.setUrl("http://192.168.1.3/arduino/R!" + type + "/" + Integer.toString(number));
      r.setPost(false);
  
      r.addResponseListener(new ActionListener()
      {
  
          public void actionPerformed(ActionEvent ev)
          {
              try
              {
                  NetworkEvent event = (NetworkEvent) ev;
                  byte[] data= (byte[]) event.getMetaData();
                  String decodedData = new String(data,"UTF-8");
                  System.out.println(decodedData);
                  lectura = decodedData;
  
              } catch (Exception ex)
              {
                  ex.printStackTrace();
                  lectura = "NoBulb";
              }
  
          }
  
  
      });
      NetworkManager.getInstance().addToQueue(r);
  
      return lectura;
      }
  
      public String writeCNO(char type, int number, int action){
  
  
          ConnectionRequest r2 = new ConnectionRequest();
          r2.setUrl("http://192.168.1.3/arduino/R!" + type + "/" + Integer.toString(number) + "/"+ action);
          r2.setPost(false);
  
          r2.addResponseListener(new ActionListener()
          {
  
              public void actionPerformed(ActionEvent ev)
              {
                  try
                  {
                      NetworkEvent event = (NetworkEvent) ev;
                      byte[] data= (byte[]) event.getMetaData();
                      String decodedData = new String(data,"UTF-8");
                      System.out.println(decodedData);
                      escritura = decodedData;
  
                  } catch (Exception ex)
                  {
                      ex.printStackTrace();
                      escritura = "NoBulb";
                  }
  
              }
  
  
          });
          NetworkManager.getInstance().addToQueue(r2);
  
          return escritura;
  }
  </code></pre>
  
  <p>However when I run it, the Console displays a bunch of errors like:</p>
  
  <blockquote>
    <p>Duplicate entry in the queue: com.codename1.io.ConnectionRequest: com.codename1.io.ConnectionRequest@22b3c488</p>
  </blockquote>
  
  <p>Help very appreciated!</p>
  
  <p>David.</p>