×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Feb 2010
    Posts
    1

    Unhappy Cannot asign value

    Hi,

    I have stumbled upon a very strange problem.
    I have created a J2ME Midlet (MIDP2.0 CLDC1.1).
    In this midlet I have a Vector containing some objects.

    The objects are simple like:
    Code:
    class A{
       private in a;
    
       public void setA(int a){
          this.a = a;
       }
    
       public int getA(){
          return a;
       }
    }
    I can retrieve the objects from the vector and read the values on these objects.
    Code:
    vector.elementAt(i).getA()
    But when I try to set a value on the object, the application sort of hangs...
    Code:
    vector.elementAt(i).setA(5)
    It does not return from this method, neither is the value set.

    Has anybody ever had this problem? And did you find a solution?

    PS: on my emulator everything works fine, but it does not work on the phone.
    PS: the value is set in the keyPressed() method of a canvas.

  2. #2
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: Cannot asign value

    What device?

    If you make the code as simple as you have it here, do you still have the problem?

    Does the actual code have any arithmetic, object access, or synchronization?

    I notice you've omitted from the code, the class cast on the result from elementAt(), which I presume is deliberately to keep things simple, yes? Or are you using your own Vector class?

    I have never seen such a problem with Vectors.

    Graham.

Similar Threads

  1. Is it possible to asign IPs to a symbian(7.0s) and a pc that are connected via bt?
    By chairmanzf in forum Symbian Networking & Messaging (Closed)
    Replies: 0
    Last Post: 2005-07-06, 04:56

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×