title: RecyclerView is displaying Null Value but No Error in the log
body: <p>I am trying to display list using recycler view but I am getting <code>null</code> value. I have three classes <code>Test</code>, <code>TestModel</code> and <code>TestListAdapter</code>. Below is my Json Output. I am getting an error in one place. </p>
  
  <p><code>val catObj = response.getJSONObject(i)</code>. </p>
  
  <p>If I mention <code>i</code> as <code>int</code> then I am getting an error so, I need to enter <code>i.toString()</code> for string conversion. Even after converting the <code>i</code> to string, I am not getting the output and no error in the error log. I am using <code>Volley</code> and <code>Kotlin</code> in my code. Any help is appreciated. </p>
  
  <pre><code>Error:--Type Mismatch
  
   val catObj = response.getJSONObject(i)
  </code></pre>
  
  <p>Json Output:</p>
  
  <pre><code>[{"id":"1","name":"AAAA"},{"id":"3","name":"BBBB"}]
  </code></pre>
  
  <p>Test Class:</p>
  
  <pre><code>class Test : AppCompatActivity() {
  
  var volleyRequest:RequestQueue?=null
  var TestList: ArrayList&lt;TestModel&gt;?=null
  var adapter:TestListAdapter?=null
  var layoutManager: RecyclerView.LayoutManager?=null
  override fun onCreate(savedInstanceState: Bundle?) {
      super.onCreate(savedInstanceState)
      setContentView(R.layout.activity_Test)
  
  
   var HelloLink="https://www.abc.app"
   TestList= ArrayList&lt;TestModel&gt;()
   volleyRequest = Volley.newRequestQueue(this)
  
      getTest(HelloLink)
  }
  
  fun getTest(url: String) {
  
      print("Url Value is:"+url)
      val catRequest = JsonObjectRequest(Request.Method.GET,
              url, Response.Listener {
          response: JSONObject -&gt;
          try {
              for (i in 0..response.length() - 1) {
                  val Test=TestModel()
                  val catObj = response.getJSONObject(i)
  
                  var name = catObj.getString("name")
  
                  Test.name = name
                  Log.d("Name Result==&gt;&gt;", name)
                  TestList!!.add(Test)
                  adapter = TestListAdapter(TestList!!, this)
                  layoutManager = LinearLayoutManager(this)
                  recyclerViewTest.layoutManager = layoutManager
                  recyclerViewTest.adapter = adapter
              }
  
              adapter!!.notifyDataSetChanged()
  
  
          }catch (e: JSONException) { e.printStackTrace()}
  
      },
              Response.ErrorListener {
                  error: VolleyError? -&gt;
                  try {
                      Log.d("Error:", error.toString())
  
                  }catch (e: JSONException){e.printStackTrace()}
              })
      volleyRequest!!.add(catRequest)
  }
  </code></pre>
  
  <p>}</p>
  
  <p>TestListAdapter Class</p>
  
  <pre><code>    class TestListAdapter(private val list:ArrayList&lt;TestModel&gt;,
                                private val context: Context):RecyclerView.Adapter&lt;TestListAdapter.ViewHolder&gt;()
  
      {
          override fun getItemCount(): Int {
              return list.size
          }
  
          override fun onCreateViewHolder(p0: ViewGroup, p1: Int): ViewHolder {
  
              val view 
  
  =LayoutInflater.from(context).inflate(R.layout.list_Test,p0,false)
          return ViewHolder(view)
      }
  
      override fun onBindViewHolder(p0: ViewHolder, p1: Int) {
  
          p0?.bindItem(list[p1])
      }
  
  
      class ViewHolder(itemView:View):RecyclerView.ViewHolder(itemView) {
  
          fun bindItem(Test:TestModel)
          {
              var name:TextView=itemView.findViewById&lt;TextView&gt;(R.id.CatName)
              name.text=Test.name
  
          }
      }
  }
  </code></pre>
  
  <p>Model Class</p>
  
  <pre><code>class TestModel
  {
      var id:Int?=null
      var name:String?=null
  
  }
  </code></pre>