-2

I have seen and searched for this method but I can not understand, what exactly does it do? I think you update the view in an adapter, here an example

    mSelectPosition = getAdapterPosition();

                if (!objection.isChecked()) {
                    notifyItemChanged(mSelectPosition);

                    objection.setChecked(true);

                    if (!ifExist(objection)) {
                        mList.add(objection);
                    }
                } else {
                    removeList(objection);
                    notifyItemChanged(mSelectPosition);
                    objection.setChecked(false);
                    check.setVisibility(View.VISIBLE);
                    check.setImageDrawable(TintUtils.createTintedDrawable(iconNormal,
                            colorNormal));
                }
dbenitobaldeon
  • 324
  • 3
  • 20
  • https://stackoverflow.com/questions/33176336/need-an-example-about-recyclerview-adapter-notifyitemchangedint-position-objec. – Bunny Aug 08 '18 at 05:48

1 Answers1

0

After the adapter has loaded your data and is showing it already, if you change the values of objects being used to by the adapter and want the interface to show the new values, you need to call notifyItemChanged to ensure the UI is updated to the new values, otherwise it may or may not update.

CodeSmith
  • 1,621
  • 1
  • 13
  • 31