【发布时间】:2020-10-16 20:52:53
【问题描述】:
只有当文件夹数组中的密码值为空时,我才想向用户显示 updated_at 数据。
JSONArray jsonArray = object.getJSONArray("data");
for (int i = 0; i < jsonArray.length(); i++) {
JSONObject dataa = jsonArray.getJSONObject(i);
JSONArray jsonArray2 = dataa.getJSONArray("folder");
for (int i2 = 0; i2 < jsonArray.length(); i2++)
{
JSONObject dataa2 = jsonArray2.getJSONObject(i2);
String password = dataa2.getString("password");
if (password.equals("null") || password.equals(null))
{
//Display data
}
else
{
// dont Display data
}
}
有办法吗?
【问题讨论】:
-
for (int i2 = 0; i2 < jsonArray.length(); i2++)改为for (int i2 = 0; i2 < jsonArray2.length(); i2++) -
哈哈哈,花时间在这真是个愚蠢的错误,非常感谢
标签: android arrays json android-studio