android.content.res.Resources$NotFoundException: String resource ID #0x0

前端 未结 7 844
清酒与你
清酒与你 2020-11-21 08:18

I\'m developing an Android app which reads data from MySQL database and I faced this error. I have this XML layout:



        
7条回答
  •  终归单人心
    2020-11-21 08:29

    if you get the values in int you have to use string for that it is throwing the error

    before

      holder.villageName.setText(villageModelList.get(position).getVillageName());
        holder.villageCount.setText(villageModelList.get(position).getPeopleCount());
        holder.peopleCount.setText(villageModelList.get(position).getPeopleCount());
    

    after

      holder.villageName.setText(villageModelList.get(position).getVillageName());
        holder.villageCount.setText(String.valueOf(villageModelList.get(position).getPeopleCount()));
        holder.peopleCount.setText(String.valueOf(villageModelList.get(position).getPeopleCount()));
    

    you can solve the error by adding the String.valueOf

提交回复
热议问题