CopyPastor

Detecting plagiarism made easy.

Score: 0.8226541876792908; Reported for: String similarity Open both answers

Possible Plagiarism

Plagiarized on 2019-03-05
by Jinal Awaiya

Original Post

Original - Posted on 2019-03-05
by Tejas Pandya



            
Present in both answers; Present only in the new answer; Present only in the old answer;

try this, final ArrayList<student> stud=new ArrayList<>(); if (c != null && c.getCount() > 0) { if (c.moveToFirst()) { do { student stu = new student(); stu.id = c.getString(id); stu.name = c.getString(name); stu.age = c.getString(age); //you need to add the Student object stu not the //ArrayList Object stud stud.add(stu); } while (c.moveToNext()); mAdapter = new Adapter(stud); recyclerView.setAdapter(mAdapter); } }
you are adding student object to adapter . you need to add student list to adapter . change your code like this

final List<student> stud = new ArrayList(); if (c.moveToFirst()) { do { student stu = new student(); stu.id = c.getString(id); stu.name = c.getString(name); stu.age = c.getString(age); stud.add(stu); // add your object to list } while (c.moveToNext());
mAdapter = new Adapter(stud); recyclerView.setAdapter(mAdapter);

        
Present in both answers; Present only in the new answer; Present only in the old answer;