title: keep checkbox activated after refreshing recyclerview with firestore
body: <p>When I click the checkbox in RecyclerView it is activated, and everything is right, but when I refresh the layout and the checkbox is not checked anymore.</p>
  
  <p>How to keep the checkbox activated after refreshing RecyclerView with Firestore?</p>
  
  <p>User.class : </p>
  
  <pre><code>class User {
          lateinit var userphoto: StorageReference
          lateinit var username:String
          lateinit var title:String
          lateinit var notes: String
          lateinit var id: String
          var isSelected:Boolean = false
          constructor( id: String?,username:String?, userphoto:StorageReference?
              , title: String?, notes: String?, isSelected:Boolean?) {
              this.title= title!!
              this.id= id!!
              this.username= username!!
              this.notes= notes!!
              this.isSelected= isSelected!!
              this.userphoto= userphoto!!
              }
  
          fun setIsSelected(selected: Boolean) {
              isSelected = selected
          }
  
      }
  </code></pre>
  
  <p>my adapter: CustomAdapter.class</p>
  
  <pre><code>class CustomAdapter( var mylist:ArrayList&lt;User&gt;)
      :RecyclerView.Adapter&lt;CustomAdapter.viewHolde&gt;() {
      var db = FirebaseFirestore.getInstance();
      var currentuser = FirebaseAuth.getInstance().currentUser!!
      private val notebookRef4 = db.collection("ShowData")
      lateinit var c: Context
  
  
      override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): viewHolde {
  
          var v = LayoutInflater.from(parent.context)
              .inflate(R.layout.iktem_list, parent, false)
          return viewHolde(v)
      }
  
      override fun getItemCount(): Int {
          return mylist.size
      }
  
      override fun onBindViewHolder(holder: viewHolde, position: Int) {
          holder.likee.setOnCheckedChangeListener(null)
          holder.likee.setChecked(mylist.get(position).isSelected)
          holder.likee.setOnCheckedChangeListener { buttonView, isChecked -&gt;
              mylist.get(position).setIsSelected(isChecked)
              var mynote = UserUID(mylist.get(position).id)
              if (isChecked) {
                  notebookRef4.document(currentuser.uid)
                      .collection("like").document(mylist.get(position).id).set(mynote)
                  mylist.get(position).setIsSelected(isChecked)
              } else {
                  notebookRef4.document(currentuser.uid)
                      .collection("like").document(mylist.get(position).id).delete()
                  mylist.get(position).setIsSelected(false)
              }
          }
      }
  
  
      @SuppressLint("ParcelCreator")
      class viewHolde(item: View) : RecyclerView.ViewHolder(item){
          @SuppressLint("WrongViewCast")
          var likee = item.findViewById(R.id.toggleButton) as ToggleButton
      }}
  </code></pre>
  
  <p>myMainActivity: RecyclerActivity.class</p>
  
  <pre><code>class RecyclerActivity : AppCompatActivity(){
     var rv:RecyclerView? = null
      var currentuser = FirebaseAuth.getInstance().currentUser!!.uid
      val str= FirebaseStorage.getInstance().reference
      var db = FirebaseFirestore.getInstance();
  
      override fun onCreate(savedInstanceState: Bundle?) {
          super.onCreate(savedInstanceState)
          setContentView(R.layout.activity_recycler)
          rec()
  
      }
  
  @SuppressLint("WrongConstant")
  fun rec(){
      var myarray=ArrayList&lt;User&gt;()
      rv=findViewById(R.id.idrecycler) as? RecyclerView
      db.collection("ProfileData")
          .addSnapshotListener { querySnapshot, firebaseFirestoreException -&gt;
              if (querySnapshot != null) {
                  for(da in querySnapshot) {
                      val note = da.toObject(Note::class.java)
                      var title = note.title
                      var description = note.notes
                      var username = note!!.username
                      var id = note!!.id
                      myarray.add(User(id!!,username!!, str.child(currentuser), title!!, description!!,false))
                  }
              }
          }
      rv!!.layoutManager= LinearLayoutManager(this, LinearLayout.VERTICAL,false)
      val c= CustomAdapter(myarray )
      rv!!.adapter=c
  
  }
  </code></pre>