在我的应用程序中,当我单击按钮时,它会命中 URL 并返回 xml 文件。从该 xml 文件中,我使用 dom 解析器和迭代器列出了特定标签。使用以下代码,我列出了 logcat 中的数据。
Iterator<String> itr = arl.listIterator();
int z=0,x=0,increment=0;
while (itr.hasNext())
{
Log.e("ViewImage5-list all "+z, itr.next());
z++;
}
现在我在 logcat 中得到的所有值我想将这些值存储在数组字符串中。如何储存它。请用代码解释一下......
最佳答案
试试这个:
Iterator<String> itr = arl.listIterator();
int z=0,x=0,increment=0;
List<String> strings = new ArrayList<String>();
while (itr.hasNext())
{
String data = itr.next();
list.add(data);
Log.e("ViewImage5-list all "+z, data);
z++;
}
// the list "strings" now holds all your strings
关于java - 如何在android中的字符串中存储迭代器值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6044104/