• 10

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191


File: /home/prodcxja/public_html/questions/application/views/question.php
Line: 191
Function: _error_handler

File: /home/prodcxja/public_html/questions/application/controllers/Questions.php
Line: 433
Function: view

File: /home/prodcxja/public_html/questions/index.php
Line: 315
Function: require_once

I'm displaying a checked recyclerview in my edit details screen of application. When I go to edit screen I'm able to get the previously selected items are marked as checked working fine, but my challenge is I'm not able to edit the previously selected items along with newly selected items. Only new selected items are updated in my server.

For ex: previuosly I selected {1,2} position items, when I go to edit screen 1,2 items are marked as checked, remaining as marked unchecked. Now if I select new items{3,4} only {3,4} added previously selected items{1,2} not added and sometimes they are not editable even.

Here is my viewholder class:

//in some cases, it will prevent unwanted situations

        //if true, your checkbox will be selected, else unselected

        for(int i=0;i<model.getTargetedMarketingOption().size();i++){

        holder.cell.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                boolean isChecked = !holder.checkBox.isChecked();
                guestListener.OnMultipleMarketOptListener(position, isChecked);

Here is selected items list get in my activity:

    public void OnMultipleMarketOptListener(int position, boolean isChecked) {


You should understand the sliding principle of recyclerView again, and then try to understand what I do below.

in you adapter:

hashMap<Int,Boolean> checkStatusMap,// int is position, Boolean is CheckStatus

in your listener class:

//Ensure that the current location is correct in recyclerView
int mPosition ;
void updateViewByPosition?int position?{
   checked= getCheckStatusByPosition(mPosition,checkStatusMap);

public void onClick(View v) {
   boolean newChecked= !getCheckStatusByPosition(mPosition,checkStatusMap);
   SaveCheckStatusByPosition(newChecked,mPosition,checkStatusMap);//You need a map or list to store state

in your onCreateViewHolder ???:

viewHolder.setOnClickListener(listener);//You need to implement a listener

Here is selected items list get in your onBindViewHolder:

public void onBindViewHolder(int position) {

Where you upload the network:

  • 1
Reply Report