title: How to cadd a swipe to refresh to my code?
body: <p>I have the following layout code in my xlm, to call my recycler view in my status fragment</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;androidx.constraintlayout.widget.ConstraintLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
      xmlns:app=&quot;http://schemas.android.com/apk/res-auto&quot;
      xmlns:tools=&quot;http://schemas.android.com/tools&quot;
      android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;match_parent&quot;
      tools:context=&quot;.fragments.Status&quot;&gt;
  
      &lt;androidx.swiperefreshlayout.widget.SwipeRefreshLayout
          android:id=&quot;@+id/swipeToRefresh&quot;
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;match_parent&quot;
          app:layout_constraintTop_toTopOf=&quot;parent&quot;
          app:layout_constraintTop_toBottomOf=&quot;parent&quot;
          app:layout_constraintLeft_toLeftOf=&quot;parent&quot;
          app:layout_constraintRight_toRightOf=&quot;parent&quot;&gt;
  
          &lt;androidx.recyclerview.widget.RecyclerView
              android:id=&quot;@+id/statusRecyclerView&quot;
              android:layout_width=&quot;match_parent&quot;
              android:layout_height=&quot;match_parent&quot;
              app:layout_constraintBottom_toBottomOf=&quot;parent&quot;
              app:layout_constraintEnd_toEndOf=&quot;parent&quot;
              app:layout_constraintStart_toStartOf=&quot;parent&quot;
              app:layout_constraintTop_toTopOf=&quot;parent&quot; /&gt;
  
      &lt;/androidx.swiperefreshlayout.widget.SwipeRefreshLayout&gt;
  </code></pre>
  <p>I tried to call this  swipe to refresh using this in my main activity, but no sucessfull so now I am attempting to use in my fragment file, the one I used the xml to get the recyclerView,and here are the errors are showen:
  <strong>Unresolved reference: mySwipeRefreshLayout---
  PackageManagerCompat.LOG_TAG can only be accessed from within the same library (androidx.core:core)---
  Unresolved reference: myUpdateOperation---
  Unresolved reference: mySwipeRefreshLayout---
  Variable expected</strong></p>
  <pre><code>package com.example.whatsappstatussaver.fragments
  
  import android.content.Context
  import android.os.Bundle
  import android.util.Log
  import android.view.View
  import androidx.core.content.PackageManagerCompat.LOG_TAG
  import androidx.fragment.app.Fragment
  import androidx.recyclerview.widget.RecyclerView
  import androidx.recyclerview.widget.StaggeredGridLayoutManager
  import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
  import com.example.whatsappstatussaver.R
  import com.example.whatsappstatussaver.adapters.StatusAdapter
  import com.example.whatsappstatussaver.dao.Dao
  import com.example.whatsappstatussaver.utils.Constants
  
  class Status() : Fragment(R.layout.fragment_status) {
  
      private lateinit var path:String
  
      override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
          super.onViewCreated(view, savedInstanceState)
  
          val sharedPref = requireContext().getSharedPreferences(&quot;dwa&quot;, Context.MODE_PRIVATE)
  
          val bool = sharedPref.getBoolean(&quot;dwaBool&quot;,false)
  
          path = if (bool){
              Constants.STATUS_LOCATION_DW
          }else{
              Constants.STATUS_LOCATION
          }
  
          setupLayout(view)
          mySwipeRefreshLayout.setOnRefreshListener(object : SwipeRefreshLayout.OnRefreshListener{
              override fun onRefresh() {
                  Log.i(LOG_TAG, &quot;onRefresh called from SwipeRefreshLayout&quot;)
                  // This method performs the actual data-refresh operation.
                  // The method calls setRefreshing(false) when it's finished.
                  myUpdateOperation()
                  mySwipeRefreshLayout.isRefreshing = false
              }
          })
  
      }
  
      private fun setupLayout(view: View){
          val filesList = Dao().getData(path, requireContext())
          println(path)
          val recyclerView = view.findViewById&lt;RecyclerView&gt;(R.id.statusRecyclerView)
          recyclerView.layoutManager = StaggeredGridLayoutManager(3,StaggeredGridLayoutManager.VERTICAL)
          val adapter = StatusAdapter(requireContext(), filesList)
          recyclerView.adapter = adapter
          adapter.notifyDataSetChanged()
      }
  
  }
  </code></pre>