简体   繁体   中英

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.

数组结构的屏幕截图,具有数据键,具有基于数字索引的数组。该子数组的第一个元素等于 11-117995。

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) .

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());
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM