Click here to Skip to main content
15,910,411 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,
I am using j2me on Eclipse and I have this code :

Java
public Vector TStatus;

    public void AddTRow(String ID,char Status){
    TStatus.addElement(new String[]{ID, String.valueOf(Status)});

	}

now I need to retrieve the value added in the vector TStatus in my code to add it to stringBuffer, therefore I used it as below:



Java
StringBuffer tBuilder = new StringBuffer();
     tBuilder.append(TStatus.elementAt(0)[1]);




but it didn't work . any help please
Posted
Updated 21-May-12 22:41pm
v3
Comments
Jim Jos 22-May-12 4:47am    
Did you check the element is added to the vector properly? Are you trying to concatnate the ID and status and store it as a new string? Not able to understand TStatus.addElement(new String[]{ID, String.valueOf(Status)});

I solved it :

Java
StringBuffer tBuilder = new StringBuffer();
     tBuilder.append(((String[])TStatus.elementAt(0))[1]);
 
Share this answer
 
Have you declared your vector as vector<string[]> may be that is the problem

here is a simple solution

Java
public Vector<string[]> TStatus = new Vector<string[]>();
	 
public void AddTRow(String ID,char Status){
    	TStatus.add(new String[] {ID, String.valueOf(Status)});
}
 
Share this answer
 
Comments
khaled377 22-May-12 9:31am    
in j2me there is only Vector and I can declared it as you r saying anyway thank u for ur reply .

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900