我在我的android项目中使用凌空来获取URL。一切都好。来自api的json数据给出localteam_id
和visitorteam_id
。以下是我的json齐射要求。
final String TEAM_ID = "688";
String fixturesURL = url;
JsonObjectRequest leagueRequest = new JsonObjectRequest(Request.Method.GET,
fixturesURL, null,
new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
//Log.d("Fixtures", response.toString());
try {
JSONArray jsonArray = response.getJSONArray("data");
for (int i = 0; i < jsonArray.length(); i++) {
JSONObject data = jsonArray.getJSONObject(i);
//Log.d("Fixtures", data.getString("id"));
String localteamID = data.getString("localteam_id");
String visitorteamID = data.getString("visitorteam_id");
String opponentID = "";
这里的问题是我需要再次使用ID提取对手的球队名称。这里的对手可能是localteam_id或visitorteam_id。我尝试了一些如果条件不起作用的情况。救救我。