Skip to content

Error in displaying data with TextView.setText: Resources$NotFoundException: String resource ID #0x0

I am getting this exception:

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

The exception stack trace points to this line in the adapter class:


This is my adapter class:

public class adapter_cgpa extends RecyclerView.Adapter<adapter_cgpa.Viewholder> {
    ArrayList<POJO> cgpaArrayList;

    public adapter_cgpa(ArrayList<POJO> cgpaArrayList) {
        this.cgpaArrayList = cgpaArrayList;

    public adapter_cgpa.Viewholder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        View listitem = LayoutInflater.from(parent.getContext()).inflate(R.layout.recycler_cgpa, parent, false);
        return new Viewholder(listitem);

    public void onBindViewHolder(@NonNull adapter_cgpa.Viewholder holder, int position) {
        POJO cgpa= cgpaArrayList.get(position);

    public int getItemCount() {
        return cgpaArrayList.size();

    public class Viewholder extends RecyclerView.ViewHolder {
        TextView cname, no_of_sems, cgpa, percentage,schemec;
        ImageButton btndelete2;

        public Viewholder(@NonNull View itemView) {

This is my POJO class:

public class POJO {
    int no_of_sems;

    public void setNo_of_sems(int no_of_sems) {
        this.no_of_sems = no_of_sems;

    public int getNo_of_sems() {
        return no_of_sems;


You’re accidentally calling the version of TextView.setText that takes an int resource ID.

You should explicitly convert it to a String: