×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    May 2013
    Posts
    153

    Please help, some problem occur in two vector giving same value .....

    I am wroking on nokia sdk20. using lwuit1.5.Now my problem is that i am using Vector but when i store some data in different vector .these vector conflict to each other. data of first vector automatic copy to another vector and value of both vector same.when i store data in first vector then i print last element of that vector that time value is ok but when i use seccond vector and store some data then same date copy in first vector.
    Please tell me why this is happened
    Code:
    Vector v=new Vector();
    v=ssm.readdaterecord(""+currentyear);
    System.out.println("storydatevector size is in mainui is  <><><><>"+v.size()+" and last date is  "+v.lastElement());     //That time last element of v  vector is ok
    Vector v2=new Vector();
     v2=ssm.readsubject(""+currentyear);
    System.out.println("captionvector size is in mainui is  <><><><>"+v2.size()+" and last caption is  "+v2.lastElement()); // That time last element of v2 vector is ok
    System.out.println("storydatevector size is in mainui is  <><><><>"+v.size()+" and last date is  "+v.lastElement());     //But now last element of v is last element of v2
    i have print all elements of v vector it print all element of v2 vector
    Please help me i got stuck

  2. #2
    Regular Contributor
    Join Date
    Dec 2012
    Location
    India
    Posts
    266

    Re: Please help, some problem occur in two vector giving same value .....

    This is pretty weird.I am not sure how or why this could happen.How many entries are being stored in these vectors roughly?

  3. #3
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Budapest, Hungary
    Posts
    28,572

    Re: Please help, some problem occur in two vector giving same value .....

    Note that allocating an object and overwriting it in the next line is not a good practice
    Code:
    Vector v=new Vector();
    v=ssm.readdaterecord(""+currentyear);
    should rather be
    Code:
    Vector v=ssm.readdaterecord(""+currentyear);
    For the actual issue, the two vectors are actually the same, probably because readdaterecord and readsubject re-use and return a single member variable. The allocations to be removed from the posted code fragment should rather happen inside those methods, so allocate and return local Vector variables there.

  4. #4
    Registered User
    Join Date
    May 2013
    Posts
    153

    Re: Please help, some problem occur in two vector giving same value .....

    thanx for reply

Similar Threads

  1. Problem while assigning value for vector
    By trungtinh in forum Open C/C++
    Replies: 2
    Last Post: 2009-08-07, 19:26
  2. Problem while assigning value for vector
    By trungtinh in forum Symbian
    Replies: 1
    Last Post: 2009-07-07, 17:39
  3. how can alloc problem occur not in AppView.cpp
    By HAHAPrince in forum Symbian
    Replies: 1
    Last Post: 2009-04-23, 11:10
  4. CAknMarkableListDialog giving Problem
    By pavan in forum Symbian User Interface
    Replies: 0
    Last Post: 2007-10-08, 07:56
  5. Problem occur in exit(app crash) after insert data in listbox and save it???
    By chandantheracer in forum Symbian User Interface
    Replies: 8
    Last Post: 2007-05-17, 08:40

Posting Permissions

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