从j2me Vector检索数据 [英] retreiving data from j2me Vector
本文介绍了从j2me Vector检索数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好,
我在Eclipse上使用j2me,我有以下代码:
Hello,
I am using j2me on Eclipse and I have this code :
public Vector TStatus;
public void AddTRow(String ID,char Status){
TStatus.addElement(new String[]{ID, String.valueOf(Status)});
}
现在,我需要在代码中检索添加到向量TStatus中的值,以将其添加到stringBuffer,因此我按如下方式使用它:
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:
StringBuffer tBuilder = new StringBuffer();
tBuilder.append(TStatus.elementAt(0)[1]);
但这没用.任何帮助请
but it didn''t work . any help please
推荐答案
您是否已将vector声明为vector< string []>可能就是问题
这是一个简单的解决方案
Have you declared your vector as vector<string[]> may be that is the problem
here is a simple solution
public Vector<string[]> TStatus = new Vector<string[]>();
public void AddTRow(String ID,char Status){
TStatus.add(new String[] {ID, String.valueOf(Status)});
}
我解决了它:
I solved it :
StringBuffer tBuilder = new StringBuffer();
tBuilder.append(((String[])TStatus.elementAt(0))[1]);
这篇关于从j2me Vector检索数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文