1

I really need your help in this one.Am working with recycle view but at this point I am trying to debug my code and check my possible error source through the LogCat. From the code, any time I delete a data (school class) through the on-click method, I display contents from the SQLite database to see if the data was actually deleted. When I click the delete button to delete a particular data (schoolclass), it is supposed to display all contents from the SQLite database in the LogCat EXCEPT the particular content that was deleted.

But at the moment, the database displays all content including the content expected to be deleted. What could be the issue, is the content actually being deleted?. what could be wrong with my entire code. I will so much appreciate your answer. Thanks!!

Here is the AdapterClass with the Onclick method for the onclick event. Notice the removeAt(getLayoutPosition());

public class ClassListOnSetupRecyclerAdapter extends RecyclerView.Adapter<ClassListOnSetupRecyclerAdapter.ClassListViewOnSetupHolder>{
    //simple list of classes(mDataSet for Adapter)
    private List<ClassesBean> listClasses;
    private RecyclerView mRecyclerView;
    private Context mContext;

    public ClassListOnSetupRecyclerAdapter(List<ClassesBean> listClasses){

        this.listClasses = listClasses;
    }

    @Override
    public ClassListViewOnSetupHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View itemView = LayoutInflater.from(parent.getContext())
                .inflate(R.layout.item_classesname_recycler,parent,false);
        return new ClassListViewOnSetupHolder(itemView);
    }

    @Override
    public void onBindViewHolder(ClassListViewOnSetupHolder holder, int position) {
        holder.textView_classname.setText(listClasses.get(position).getClasses_name());
    }

    @Override
    public int getItemCount() {
        Log.v(ClassListOnSetupRecyclerAdapter.class.getSimpleName(),""+listClasses.size());
        return listClasses.size();
    }

  //  The View Holder Class
    public class ClassListViewOnSetupHolder extends RecyclerView.ViewHolder implements View.OnClickListener {

        public TextView textView_classname;
        public Button delete_button_classsetup;
        public ClassListViewOnSetupHolder(View itemView) {
            super(itemView);
            textView_classname = itemView.findViewById(R.id.textView_classname);
            delete_button_classsetup = itemView.findViewById(R.id.delete_button_classsetup);
            itemView.setOnClickListener(this);
            delete_button_classsetup.setOnClickListener(this);
            textView_classname.setOnClickListener(this);
        }

        @Override
        public void onClick(View view) {

            Toast.makeText(view.getContext(), "position = " + getAdapterPosition(), Toast.LENGTH_SHORT).show();
            Log.i("Removed", "pressed");
            if(view.equals(delete_button_classsetup)){                     
                removeAt(getLayoutPosition());                  
                Log.i("dbDel", "Successful");
            }
        }
    }

The removeAt() method

public void removeAt(int position){              
            demeaSQL.deleteAClass(classesBean);

                listClasses.remove(position);
                mRecyclerView.removeViewAt(position);
                notifyItemRemoved(position);
                notifyItemRangeChanged(position, listClasses.size());
                notifyDataSetChanged();

            if (demeaSQL != null) {
                StringBuilder sb = new StringBuilder();
                for (ClassesBean c : demeaSQL.getAllClasses()) {
                    sb.append(" ClassName= " + c.getClasses_name() + " ClassItemIndex= " + c.getClasses_item_index());
                    sb.append("\n");
                }
                Log.i("dbContent", sb.toString());
            }    
        }

SQLDatabase Delete Function.

public void deleteAClass(ClassesBean aClass){
        SQLiteDatabase db =this.getWritableDatabase();    
        db.delete(TABLE_CLASSES,COLUMN_CLASSES_ID + "=?",
                new String[]{String.valueOf(aClass.getId())});  
        db.close();  
    }

create classes_table sql query

 private String CREATE_CLASSES_TABLE = "CREATE TABLE IF NOT EXISTS " + TABLE_CLASSES + "("
            + COLUMN_CLASSES_ID + " INTEGER PRIMARY KEY AUTOINCREMENT," + COLUMN_CLASS_ITEM_INDEX + " NUMBER,"
            + COLUMN_CLASSES_NAME + " VARCHAR," + COLUMN_CLASSES_CODENAME + " VARCHAR, " + COLUMN_CLASSES_SECTIONS + " VARCHAR," + COLUMN_CLASSES_TEACHERS
            + " VARCHAR," + COLUMN_CLASSES_STUDENTS + " VARCHAR" + ")";
@Override
    public void onCreate(SQLiteDatabase sqLiteDatabase) {

        sqLiteDatabase.execSQL(CREATE_USER_TABLE);
        sqLiteDatabase.execSQL(CREATE_SCHOOL_TABLE);
        sqLiteDatabase.execSQL(CREATE_CLASSES_TABLE);    
    }

Here is my ClassesBean Class.

public class ClassesBean {    
    private int id;
    private int classes_item_index;
    private String classes_name;
    private String classes_codename;
    private String classes_sections;
    private String classes_teachers;
    private String classes_students;

    public int getClasses_item_index() {
        return classes_item_index;
    }

    public void setClasses_item_index(int classes_item_index) {
        this.classes_item_index = classes_item_index;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getClasses_name() {
        return classes_name;
    }

    public void setClasses_name(String classes_name) {
        this.classes_name = classes_name;
    }

    public String getClasses_codename() {
        return classes_codename;
    }

    public void setClasses_codename(String classes_codename) {
        this.classes_codename = classes_codename;
    }

    public String getClasses_sections() {
        return classes_sections;
    }

    public void setClasses_sections(String classes_sections) {
        this.classes_sections = classes_sections;
    }

    public String getClasses_teachers() {
        return classes_teachers;
    }

    public void setClasses_teachers(String classes_teachers) {
        this.classes_teachers = classes_teachers;
    }

    public String getClasses_students() {
        return classes_students;
    }

    public void setClasses_students(String classes_students) {
        this.classes_students = classes_students;
    }    
}
MikeT
  • 51,415
  • 16
  • 49
  • 68
Aham_Uzoma
  • 91
  • 10
  • so your question is really about why `delete` does not seem to work? – Scary Wombat Feb 01 '18 at 00:31
  • try debugging in and see what is happening in `deleteAClass` - is it called? is it throwing an excpetion? Do you need a transaction? Is the value passed in correct? – Scary Wombat Feb 01 '18 at 00:33
  • Try using `public void deleteAClass(ClassesBean aClass){ SQLiteDatabase db =this.getWritableDatabase(); String id = String.valueOf(aClass.getId()); Cursor debug = db.query(TABLE_CLASS,null,COLUMN_CLASSES_ID + "=?",id,null,null,null); if (debug.getCount() < 1) { Log.d("DELETEACLASS","ID " + id + " not in table " + TABLE_CLASS + "!!!"); } debug.close(); db.delete(TABLE_CLASSES,COLUMN_CLASSES_ID + "=?", new String[]{String.valueOf(aClass.getId())}); db.close(); }` then check log. – MikeT Feb 01 '18 at 01:04
  • The above (as a temporary replacement for the **`deleteAClass`** method) will check if the row exists, writing a message to the log if it doesn't. This is most likely the cause of the issue. – MikeT Feb 01 '18 at 01:06
  • Yes @ScaryWombat the delete does not work. deleteAClass is called at the "removeAt" method. as for debuging, I am checking my contents through the Logcat to see if it is actually deleting. – Aham_Uzoma Feb 01 '18 at 01:42

1 Answers1

1

I believe that your issue is that you are using position as the id.

Position will not equate to the id of the row in the underlying table who's data is displayed at that position.

For instance for a table where there has only been inserts and the data in the RecyclerView is displayed according to id order then (the closest sceanrio) :-

At Position 0 the id would be 1 (there is no id 0 as the first id is 1 (unless you force 0)).

At Position 1 the id would be 2 etc......

If the row with id 1 is deleted from the table then at Position 0 the id would be 2 etc (subsequent deletions especially if not at the end introduces further disparity).

You have to use some other method to ascertain the row that is to be deleted.

  • You could have a complimentary/parallel long array built from the extracted cursor where element/position 0 equates to the first id etc (no good if filtering/sorting is undertaken with the adapter).

  • You could use an array of objects as the source for the adapter where a member of the object is the respective id, this can the be extracted from the instance as determined by the position.

  • If the data that is displayed will uniquely identify the row then that could be used as the selection/where clause for the delete.

Edit - Working Example

Here's a working example based upon you code (note uses longClick for deletion whilst click just issues a just displaying the row's id).

The Database Helper (just for classes) :-

public class DBHelper extends SQLiteOpenHelper {

    public static final String DBNAME = "acedema";
    public static final int DBVERSION = 1;
    public static final String TB_CLASSES = "classes";
    public static final String COL_CLASS_ID = BaseColumns._ID;
    public static final String COL_CLASS_ITEM_INDEX = "class_item_index";
    public static final String COL_CLASS_NAME = "class_name";
    public static final String COL_CLASS_CODENAME = "class_codename";
    public static final String COL_CLASS_SECTIONS = "class_section";
    public static final String COL_CLASS_TEACHERS = "class_teachers";
    public static final String COL_CLASS_STUDENTS = "class_students";

    SQLiteDatabase mDB;


    public DBHelper(Context context) {
        super(context, DBNAME, null, DBVERSION);
        mDB = this.getWritableDatabase();
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        String crtsql = "CREATE TABLE IF NOT EXISTS " + TB_CLASSES +
                "(" +
                COL_CLASS_ID + " INTEGER PRIMARY KEY, " +
                COL_CLASS_ITEM_INDEX + " NUMBER, " +
                COL_CLASS_NAME + " TEXT, " +
                COL_CLASS_CODENAME + " TEXT, " +
                COL_CLASS_SECTIONS + " TEXT, " +
                COL_CLASS_TEACHERS + " TEXT, " +
                COL_CLASS_STUDENTS + " TEXT " +
                ")";
        db.execSQL(crtsql);


    }

    public long insertClass(int item_index, String classname, String classcode, String classsections, String classteachers, String classstudents) {
        ContentValues cv = new ContentValues();
        cv.put(COL_CLASS_ITEM_INDEX,item_index);
        cv.put(COL_CLASS_NAME,classname);
        cv.put(COL_CLASS_CODENAME,classcode);
        cv.put(COL_CLASS_SECTIONS,classsections);
        cv.put(COL_CLASS_TEACHERS,classteachers);
        cv.put(COL_CLASS_STUDENTS,classstudents);
        return mDB.insert(TB_CLASSES,null,cv);
    }

    public int deleteAClass(long id) {
        String whereclause = COL_CLASS_ID + "=?";
        String[] whereargs = new String[]{String.valueOf(id)};
        return mDB.delete(TB_CLASSES,whereclause,whereargs);
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

    }

    public List<ClassesBean> getClasses() {

        ArrayList<ClassesBean> rv = new ArrayList<ClassesBean>();
        Cursor csr = mDB.query(TB_CLASSES,null,null,null,null,null,null);
        while (csr.moveToNext()) {
            ClassesBean cb = new ClassesBean();
            cb.setId(csr.getLong(csr.getColumnIndex(COL_CLASS_ID)));
            cb.setClasses_item_index(csr.getInt(csr.getColumnIndex(COL_CLASS_ITEM_INDEX)));
            cb.setClasses_name(csr.getString(csr.getColumnIndex(COL_CLASS_NAME)));
            cb.setClasses_codename(csr.getString(csr.getColumnIndex(COL_CLASS_CODENAME)));
            cb.setClasses_sections(csr.getString(csr.getColumnIndex(COL_CLASS_SECTIONS)));
            cb.setClasses_teachers(csr.getString(csr.getColumnIndex(COL_CLASS_TEACHERS)));
            cb.setClasses_students(csr.getString(csr.getColumnIndex(COL_CLASS_STUDENTS)));
            rv.add(cb);
        }
        return rv;
    }
}

Notes

  • The getClasses method is used to get the classes from the table.
  • The deleteAClass is what deletes a class according to the id.

MainActivity.java

This is the Activity that displays the RecylcerView :-

public class MainActivity extends AppCompatActivity {
    RecyclerView mClassListRV;
    ClassRVAdapter mCRVAdapter;
    LinearLayoutManager mLLM;
    DBHelper mDBH;
    List<ClassesBean> mClassList;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        mClassListRV = (RecyclerView) this.findViewById(R.id.classlist);
        mDBH = new DBHelper(this); // Ready to use DBHelper

        addSomeData(); //<<<< Add some data for testing

        mClassList = mDBH.getClasses(); // Get the list of classes from the DB

        mLLM = new LinearLayoutManager(this); 
        mClassListRV.setHasFixedSize(true);
        mClassListRV.setLayoutManager(mLLM);
        mCRVAdapter = new ClassRVAdapter(this,mClassList);
        mClassListRV.setAdapter(mCRVAdapter);
    }

    public void removeAt(int position, long id) {
        mDBH.deleteAClass(id);

        mClassList.remove(position);
        mClassListRV.removeViewAt(position);
        mCRVAdapter.notifyItemRemoved(position);
        mCRVAdapter.notifyDataSetChanged();
    }


    private void addSomeData() {
        if (DatabaseUtils.queryNumEntries(mDBH.getWritableDatabase(),DBHelper.TB_CLASSES) < 1) {
            mDBH.insertClass(10, "English", "E101", "XYZ", "Fred Smith, Bert Bloggs", "JANET, JOHN");
            mDBH.insertClass(11, "English Literature", "E201", "ZXY", "Tom Brown, Bill Rigidspear", "JOHN, MARY");
            mDBH.insertClass(22, "Chemistry", "C045", "H2O", "Bert Steinein", "SUSAN, JOE");
        }
    }
}

Notes

  • The addSomeData method just adds some data for testing but only if there is no data.
  • The removeAt method is what is called when an item is long clicked.

ClassRVAdapter.java

This is the equivalent of ClassListOnSetupRecyclerAdapter but simplified to just list the class name and teachers columns.

public class ClassRVAdapter extends RecyclerView.Adapter<ClassRVAdapter.ClassViewHolder> {

    private List<ClassesBean> mClasses;
    Context mContext;

    public static class ClassViewHolder extends RecyclerView.ViewHolder {

        TextView mClassName;
        TextView mTeachers;

        public ClassViewHolder(final Context context, View v, final List<ClassesBean> classes) {
            super(v);
            mClassName = (TextView) v.findViewById(R.id.classname);
            mTeachers = (TextView) v.findViewById(R.id.teachers);
            v.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    long id = classes.get(getAdapterPosition()).getId();
                    Toast.makeText(context,"You Clicked ID = " + String.valueOf(id), Toast.LENGTH_SHORT).show();
                }
            });
            v.setOnLongClickListener(new View.OnLongClickListener() {
                @Override
                public boolean onLongClick(View v) {
                    ((MainActivity) context).removeAt(getAdapterPosition(),classes.get(getAdapterPosition()).getId());
                    return true; // Mark event as having been handled
                }
            });
        }
    }

    public ClassRVAdapter(Context context, List<ClassesBean> classes) {
        mContext = context;
        mClasses = classes;
    }

    @Override
    public ClassRVAdapter.ClassViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View v = LayoutInflater.from(parent.getContext())
                .inflate(R.layout.class_list_item, parent, false);
        return new ClassViewHolder(mContext,v,mClasses);
    }

    @Override
    public void onBindViewHolder(ClassViewHolder vh, int position) {
        vh.mClassName.setText(mClasses.get(position).getClasses_name());
        vh.mTeachers.setText(mClasses.get(position).getClasses_teachers());    
    }

    @Override
    public int getItemCount() {
        return mClasses.size();
    }
}

ClassesBean.java

public class ClassesBean {
    private long id;
    private int classes_item_index;
    private String classes_name;
    private String classes_codename;
    private String classes_sections;
    private String classes_teachers;
    private String classes_students;

    public int getClasses_item_index() {
        return classes_item_index;
    }

    public void setClasses_item_index(int classes_item_index) {
        this.classes_item_index = classes_item_index;
    }

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public String getClasses_name() {
        return classes_name;
    }

    public void setClasses_name(String classes_name) {
        this.classes_name = classes_name;
    }

    public String getClasses_codename() {
        return classes_codename;
    }

    public void setClasses_codename(String classes_codename) {
        this.classes_codename = classes_codename;
    }

    public String getClasses_sections() {
        return classes_sections;
    }

    public void setClasses_sections(String classes_sections) {
        this.classes_sections = classes_sections;
    }

    public String getClasses_teachers() {
        return classes_teachers;
    }

    public void setClasses_teachers(String classes_teachers) {
        this.classes_teachers = classes_teachers;
    }

    public String getClasses_students() {
        return classes_students;
    }

    public void setClasses_students(String classes_students) {
        this.classes_students = classes_students;
    }
}

Notes

  • id has been changed from int to long otherwise unchanged.

class_list_item.xml

Just a hastily thrown together layout :-

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="horizontal"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_margin="5dp">
    <TextView
        android:id="@+id/classname"
        android:layout_width="0dp"
        android:layout_weight="1"
        android:layout_height="match_parent" />
    <TextView
        android:id="@+id/teachers"
        android:layout_width="0dp"
        android:layout_weight="1"
        android:layout_height="match_parent" />
</LinearLayout>

Results :-

Initial display :-

enter image description here

2nd row clicked (Toast) :-

enter image description here

2nd row long-clicked (deleted) :-

enter image description here

MikeT
  • 51,415
  • 16
  • 49
  • 68
  • Hello @MikeT I like your answer and I quite understand this point, but how about the delete method in the database class. It should at least perform deletion before I can then apply it to the recycle view where I will then be concerned about positions and ids matching. At this point. I am just trying to perform a simple delete operation through an onclick listener to check the viability of my delete function. Though I have not yet tried the code you gave as suggestions. Above I will try it immediately I get to work and get back to you. – Aham_Uzoma Feb 01 '18 at 05:48
  • @Aham_Uzoma Deletion is dependant upon the click, the click is a an item within the list thus positiuon is required for deletion. You have to pass something to `removeAt` so that it can pass something through to `deleteAClass`. I can't see how `classesBean` is related to position. The Toast in `onClick` gives the impression that you're using position. See my previous comment and copy that code in as a replacement for `deleteAClass` that will show you the id being passed if the id is not a row in the table. – MikeT Feb 01 '18 at 06:31
  • Hello sir @MikeT I have run the code you presented . and also a syntax error was showing up for id, it required an array so I changed it to 'String[] id = {String.valueOf(aClass.getId())};' .this is what I got in the Logs D/DELETEACLASS: ID [Ljava.lang.String;@d901fef not in table classes!!! – Aham_Uzoma Feb 01 '18 at 08:49
  • Please @MikeT what does that mean and how can I work to resolve it. And thanks to you for this is the most meaningful debug I have found so far for the past one week trying to solve this issue. – Aham_Uzoma Feb 01 '18 at 08:53
  • `[Ljava.lang.String;@d901fef` is obviously not an id (integer). Rather it's that aCLass.getId() is returning a String array. See [what is Ljava.lang.String;@](https://stackoverflow.com/questions/9868482/what-is-ljava-lang-string). Perhaps passing position (`removeAt(getAdapterPosition());` and using this as the index of the String array returned from `aCalss.getId()` may be the id that should be deleted. Depends on the ClassesBean class (perhaps edit your question to include ClassesBean) – MikeT Feb 01 '18 at 09:26
  • Hello @MikeT I edited the question with more detailed code on the onclick method. here, I showed more details on the adapter class, removeAt method. These are what i actually implemented got the error and started debuging. I will appreciate it if you look into the edited question to see where my problem could be originating. – Aham_Uzoma Feb 01 '18 at 09:29
  • I have added the ClassesBean class to my question @MikeT – Aham_Uzoma Feb 01 '18 at 09:33
  • Try **`demeaSQL.deleteAClass(listClasses.get(position).getId());`** also suggest changing to `int deleted_count = db.delete(TABLE_CLASSES,COLUMN_CLASSES_ID + "=?", new String[]{String.valueOf(aClass.getId())});` then return count and check if = 1 before removing from listclasses (so you only remove from the listclasses if it was deleted). – MikeT Feb 01 '18 at 10:05
  • Hello @MikeT, what will be the parameter for the Delete method in the database 'public int deleteAClass(ClassesBean aClass)' ? as it is requiring an int value. Because of this ' academeaSQL.deleteAClass(listClasses.get(position).getId()); ' – Aham_Uzoma Feb 01 '18 at 14:13
  • Currently it's an **int**, as per the `getId` method defined in **ClassBean** as `listclasses` is a `List` of **ClassBean** objects. However, really you should use long for id;s as they can be up to 9223372036854775807. But yes `public void deleteAClass(int id){ SQLiteDatabase db =this.getWritableDatabase(); db.delete(TABLE_CLASSES,COLUMN_CLASSES_ID + "=?", new String[]{String.valueOf(id)}); db.close(); }` – MikeT Feb 01 '18 at 19:28
  • as you said @MikeT, in my db `public int deleteAClass(long id){ SQLiteDatabase db =this.getWritableDatabase(); int deleted_count = db.delete(TABLE_CLASSES,COLUMN_CLASSES_ID + "=?", new String[]{String.valueOf(id)}); db.close(); return deleted_count; }` and in my onClick `int delete_count = 0; delete_count = demeaSQL.deleteAClass(delete_count); if(view.equals(delete_button_classsetup) && delete_count == 1){ removeAt(getAdapterPosition());` But still does not delete. – Aham_Uzoma Feb 01 '18 at 21:08
  • Are you setting the id's when you build the ListClasses passed to `ClassListOnSetupRecyclerAdapter` ?. – MikeT Feb 01 '18 at 21:16
  • I am @MikeT finding it difficult to understand your question, I am still an android armature. Pardon me. But I dont Think I am – Aham_Uzoma Feb 01 '18 at 21:22
  • @MikeT.But if you are referring to ClassesBean class, I am Setting the Ids – Aham_Uzoma Feb 01 '18 at 21:30
  • ListClasses (a List of ClassBean objects) is the source data for the RecyclerView (that's what is listed). You build this list(presumably) from the Database. When you add a Classbean to the list you use methods such as `setClasses_item_index` and so on to set the data. YOU MUST USE `setId` to set the id as per the tables id column. – MikeT Feb 01 '18 at 21:31
  • Add `Log.d("PASSEDID","The id passed was " + String.valueOf(id));` as the first line in the `deleteAClass` method. Run what is the value? – MikeT Feb 01 '18 at 21:35
  • the passed id was 0(zero) – Aham_Uzoma Feb 01 '18 at 21:41
  • So the id being extracted from the ListClass is 0. In removeAT method add logging of the various values from the ListClass e..g `Log.d("CLASSNAME","You clikced the class with a name of " + listClasses.get(position).getClasses_name());`, then run. Are the values correct for the clicked class? If they are then the id is not being set to the value as per the table i.e. the **COLUMN_CLASSES_ID**. – MikeT Feb 01 '18 at 21:54
  • This is a whole lot of work you have put in here just to answer my question @MikeT I so much appreciate this. I will get back to you after testing. – Aham_Uzoma Feb 02 '18 at 18:36
  • Hello @MikeT it has been a long journey. It worked Like magic!! wow!!!. I appreciate your time and devotion to solving this issue irrespective of my low reputation and inability to vote answers in this platform, you are such a good person. – Aham_Uzoma Feb 02 '18 at 20:12
  • @Aham_Uzoma great that you've got it working. I'd appreciate you ticking this as the answer. – MikeT Feb 02 '18 at 20:35
  • Hello @MikeT am having a Little problem, `getAdapterPosition()` is returning -1, if I want to delete the some rows I get an `ArrayIndexOutofBoundException length 10 index -1` please what should i do here? – Aham_Uzoma Feb 07 '18 at 23:19
  • @Aham_Uzoma you are probably using getAdapterPosition() when no position has been set. Basically only call it in onClicks. The example provided did deletions by long-clicking. – MikeT Feb 08 '18 at 00:21
  • That is what I am doing right now but it still returning -1 @MikeT – Aham_Uzoma Feb 08 '18 at 08:15
  • @Aham_Uzoma you must have made some changes to the code. I'd suggest asking a new question as it's impossible to know what new code has been added. However, really you need to look into debugging your code examples of using logging have been used above. Odds on your IDE (e.g. Android Studio) has debugging tools where you can click on a line of code and set a breakpoint and inspect variables. Here's a link [Debug Your App](https://developer.android.com/studio/debug/index.html) – MikeT Feb 08 '18 at 19:22
  • Hello @MikeT can you please look into this question I will so much appreciate it. Thanks!!! [link] (https://stackoverflow.com/questions/49048838/how-to-match-database-ids-of-recyclerview-and-textview-items) – Aham_Uzoma Mar 01 '18 at 12:59