当用户搜索电影名称通过输入字母/信件时,它仅显示一个(最后)电影名称并给出资源类型错误



我正在从Cinemalytics Server中获取数据并在ListView中显示,但最后一个电影名称显示了多个时间...从服务器获取数据moviename = new ArrayList<>(); CurrentMovie C = new CurrentMovie();

JSONArray values = new JSONArray(json);
for(int i = 0; i < values.length(); i++) {
    JSONObject jsonObject = values.getJSONObject(i);
    String movieTitle = jsonObject.getString("Title");
    Log.e(TAG,"GIRISH"+movieTitle);
    c.setTitle(movieTitle);
    moviename.add(c);
    //binding through adapter
     mAdapter = new MovieAdapter
               (getApplicationContext(),moviename);
                lv.setAdapter(mAdapter);

错误logcat:-----

Failure getting entry for 0x010804e0 (t=7 e=1248) (error -75)
06-23 07:37:00.075 5141-5164/com.example.maau.movieinfo W/ResourceType: Failure getting entry for 0x0108051f (t=7 e=1311) (error -75)
06-23 07:37:00.075 5141-5164/com.example.maau.movieinfo W/ResourceType: Failure getting entry for 0x01080027 (t=7 e=39) (error -75)
06-23 07:37:00.075 5141-5164/com.example.maau.movieinfo W/ResourceType: Failure getting entry for 0x01080403 (t=7 e=1027) (error -75)
06-23 07:37:00.075 5141-5164/com.example.maau.movieinfo W/ResourceType: Failure getting entry for 0x010802ae (t=7 e=686) (error -75)
06-23 07:37:00.076 5141-5164/com.example.maau.movieinfo W/ResourceType: Failure getting entry for 0x01080276 (t=7 e=630) (error -75)

替换

Log.e(TAG,"GIRISH"+movieTitle);
c.setTitle(movieTitle);

Log.e(TAG,"GIRISH"+movieTitle);
c = new Currentmovie();
c.setTitle(movieTitle);

原因是您只能创建电影一次,然后多次将同一电影添加到列表中。每次添加一次时,都会为其设置一个新名称。但是由于该列表多次包含相同的对象,因此所有列表项的标题都是相同的 - 您设置为对象

的最后一个标题

相关内容

最新更新