[英]How can I get the data from an array inside another array that stores values in Java?
I have an array and this array has another array inside.我有一个数组,这个数组里面有另一个数组。
I need to obtain the data inside this other array.我需要获取另一个数组中的数据。
This is the code that I use to get all the array items, but I am not sure how to get the other array elements that are stored at index(0)
.这是我用来获取所有数组项的代码,但我不确定如何获取存储在
index(0)
的其他数组元素。
if (msg.equals("warning")) {
List<String> dataWarn = (ArrayList<String>) data;
Log.i("api", dataWarn.toString());
}
I think you're almost there.我想你快到了。 Just get the first element from the list twice:
只需两次从列表中获取第一个元素:
if (msg.equals("warning")) {
List<String> dataWarn = (List<String>) data;
List<String> dataWatnItem0 = (List<String>) dataWarn.get(0);
Log.i("api", dataWatnItem0.get(0).toString());
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.