0
這是我的代碼的一部分,在我的代碼中,我獲得了電影的「標題」和「大綱」,但「profile 「部分由於某種原因不起作用,我無法從網站獲得img鏈接,這裏是website api,謝謝你的幫助。Android - 如何從API獲取url /鏈接(rottentomatoes)JSON
@Override
protected void onPostExecute(String response) {
super.onPostExecute(response);
try {
// convert the String response to a JSON object
JSONObject jsonResponse = new JSONObject(response);
// fetch the array of movies in the response
JSONArray jArray = jsonResponse.getJSONArray("movies");
// add each movie's title to a list
movieTitles = new ArrayList<String>();
movieSynopsis = new ArrayList<String>();
movieImgUrl= new ArrayList<String>(); // **problematic**
for (int i = 0; i < jArray.length(); i++) {
JSONObject movie = jArray.getJSONObject(i);
movieTitles.add(movie.getString("title"));
movieSynopsis.add(movie.getString("synopsis"));
movieImgUrl.add(movie.getString("profile")); // **problematic**
}
謝謝! – user1924895