Q:

Recycler View not showing jason data in kotlin

here is my main class where i'm adding json data in ArrayList using volley.
Toast show the json data but array does not show any data. i'm trying to solve my error from last 3 days 
 i also read many questions on stack but i have no solution for this please help me 
 var item = ArrayList<dumy_item_list>()
        var url = "https://apps.faizeqamar.website/charity/api/organizations"
        var rq: RequestQueue = Volley.newRequestQueue(this)
        var sr = StringRequest(Request.Method.GET, url, Response.Listener { response ->
            var jsonResponse = JSONObject(response)
            var jsonArray: JSONArray = jsonResponse.getJSONArray("data")
            for (i in 0..jsonArray.length() - 1) {
                var jsonObject: JSONObject = jsonArray.getJSONObject(i)
                var name = jsonObject.getString("name")
                val data = dumy_item_list()
                data.setName(jsonObject.getString(name))
                item.add(data)
                Toast.makeText(applicationContext, "NGO Name is : $name", Toast.LENGTH_LONG).show()
            }
        },
            Response.ErrorListener { error ->

                Toast.makeText(applicationContext, error.message, Toast.LENGTH_LONG).show()
            })

        rq.add(sr)
        var away_recycler = findViewById<RecyclerView>(R.id.away_recycler)

        var adaptor = custom_adopter(item, applicationContext)

        away_recycler.layoutManager = GridLayoutManager(applicationContext, 1)

        away_recycler.adapter = adaptor

    }

here is my adapter class wher i'm using getName() function
class custom_adopter(data: ArrayList<dumy_item_list>, var context: Context) :
    RecyclerView.Adapter<custom_adopter.viewHolder>() {
    var data: List<dumy_item_list>
    init {
        this.data = data
    }
    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): custom_adopter.viewHolder {

        var layout = LayoutInflater.from(context).inflate(R.layout.dumy_item, parent, false)
        return viewHolder(layout)
    }
    override fun onBindViewHolder(holder: custom_adopter.viewHolder, position: Int) {
        holder.tv_dummy_name_donnor.text = data[position].getName()
        holder.card.setOnClickListener {
            var intent = Intent(context, ngosProfile::class.java)
            intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
            startActivity(context, intent, null)
        }
    }
    override fun getItemCount(): Int {
        return data.size
    }
    class viewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
        internal var tv_dummy_name_donnor: TextView
        internal var card: CardView
        init {
            tv_dummy_name_donnor = itemView.findViewById(R.id.tv_dummy_name_donnor)
            card = itemView.findViewById(R.id.card)
        }
    }
}

A:

follow this code this work for me. (var adaptor = custom_adopter(item, applicationContext) away_recycler.adapter = adaptor progressBar2?.visibility = View.INVISIBLE ) singe the value to adaptor after the loop.
class MainActivity : AppCompatActivity() {

    var progressBar2:ProgressBar?=null

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        var item = ArrayList<dumy_item_list>()
        var progressBar2 = findViewById<ProgressBar>(R.id.progressBar2)
        var away_recycler = findViewById<RecyclerView>(R.id.away_recycler)
        away_recycler.layoutManager = GridLayoutManager(applicationContext, 1)

        var url = "https://apps.faizeqamar.website/charity/api/organizations"
        var rq: RequestQueue = Volley.newRequestQueue(this)

            var sr = StringRequest(Request.Method.GET, url, Response.Listener { response ->
                var jsonResponse = JSONObject(response)
                var jsonArray: JSONArray = jsonResponse.getJSONArray("data")
                for (i in 0..jsonArray.length() - 1) {
                    var jsonObject: JSONObject = jsonArray.getJSONObject(i)
                   var name = jsonObject.getString("ngo_name")
                   var about = jsonObject.getString("ngo_desc")
                    item.add(dumy_item_list(name,about))

                }
                var adaptor = custom_adopter(item, applicationContext)
                away_recycler.adapter = adaptor
                progressBar2?.visibility = View.INVISIBLE

            },
                Response.ErrorListener { error ->

                })

            rq.add(sr)

        }

