| Reply | « Previous Thread | Next Thread » |
|
Hi,
i have a little problem with filling a vector. Here is a easy example of my problem. 1. I fill a vector with a string array containing two values: Code:
for(int i = 0; i<10; ++i){
test[0] = "Test";
test[1] = " "+ i;
vector.addElement(test);
}
Code:
for(int i = 0; i<10; ++i){
String[] test2 = (String[])vector.elementAt(i);
System.out.println("[0]" + test2[0]);
System.out.println("[1]" + test2[1]);
}
The strings I get back are not like: [0] Test [1] 1 [0] Test [1] 2 [0] Test [1] 3 . . . [0] Test [1] 9 They are only ten times [0] Test [1] 9 So i think the first for loop adds only ten times the same object to the vector. Can anybody help me. Greetings Alex |
|
OK I've got the solution.
I had to define the string array test localy in the first loop and not global on the MIDlet. |
| Reply | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|
| Thread | Thread Starter | Forum | Replies | Last Post |
|---|---|---|---|---|
| CTelephony Problems in N73 | saji_iq | Symbian Networking & Messaging | 0 | 2007-02-07 08:57 |
| Several problems with NMIT 4.1 | jtalviva | General Browsing | 1 | 2006-03-20 14:00 |
| Several problems with NMIT 4.1 MMS | jtalviva | General Messaging | 0 | 2006-03-10 12:03 |
| Several problems with NMIT 4.1 | jtalviva | Mobile Java Tools & SDKs | 0 | 2006-03-10 11:59 |
| Problems with Nokia carkit CK-1W | Batunas | General Discussion | 1 | 2004-02-09 19:18 |