java-memidplcdui

IllegalArgumentException at javax.microedition.lcdui.TextField.setChars


I have wrote a simple web service in .NET which return a string value.

[WebMethod]
    public string DeveloperInfo()
    {
        return "Chamara is the appliaction developer";
    }

I need to consume it using a J2ME application.following is the code i have used

if (displayable == ServiceForm) {
        if (command == exitCommand1) {
            // write pre-action user code here
            switchDisplayable(null, getTaskList());
            // write post-action user code here
        } else if (command == okCommand2) {
        try
        {
            new Thread(new Runnable()
          {
              public void run()
              {
         try {
                  service1.Service1_Stub service=new service1.Service1_Stub();

             String Info= service.DeveloperInfo().toString();
             txtService.setString(Info);
                // write post-action user code here
            } catch (Exception ex) {
                ex.printStackTrace();
            }
              }
          }).start();
        }catch (Exception e){System.out.println(e.toString());}

It gives the following Exception

java.lang.IllegalArgumentException
    at javax.microedition.lcdui.TextField.setChars(TextField.java:747)
    at javax.microedition.lcdui.TextField.setString(TextField.java:666)
    at com.sliit.j2me.tutorial.TaskList$1.run(TaskList.java:155)

Where I have got wrong?


Solution

  • It seems TextBox constraint fails.
    Ex. The Text is set to take input numbers and you try to set alphabets into it. check it and if it isn't the case then post the contain of Info.