title: how to fix error lkotlin.UninitializedPropertyAccessException: lateinit property adapters has not been initialized in my code?
body: <p>does not set adapter and work it in Kotlin</p>
  
  <p>I take data from retrofit and i test it ,it work.
  but when pass array list to adapter,it cant set list
  and have error:</p>
  
  <p>kotlin.UninitializedPropertyAccessException: lateinit property adapters has not been initialized</p>
  
  <p>myadapter:</p>
  
  <pre><code>class RecyclerSaleAdapter(var sale_list: ArrayList&lt;sale_agahi&gt;): RecyclerView.Adapter&lt;RecyclerSaleAdapter.ViewHolder&gt;(){
      override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
          val v = LayoutInflater.from(parent.context).inflate(R.layout.recycler_sale_item, parent, false)
          return ViewHolder(v)
      }
  
      override fun getItemCount(): Int {
          return  sale_list.size
      }
  
      override fun onBindViewHolder(holder: ViewHolder, position: Int) {
          holder.cost_view.text=sale_list[position].cost.toString()
          holder.area.text=sale_list[position].area
          holder.info_view.text=sale_list[position].info
          holder.metr_view.text=sale_list[position].metr.toString()
  
      }
  
      class ViewHolder(itemView: View): RecyclerView.ViewHolder(itemView){
          val ImageView=itemView.findViewById&lt;ImageView&gt;(R.id.image_sale_view)
          val cost_view=itemView.findViewById&lt;TextView&gt;(R.id.cost_text_rec_view)
          val area=itemView.findViewById&lt;TextView&gt;(R.id.area_text_rec_view)
          val info_view=itemView.findViewById&lt;TextView&gt;(R.id.info_text_rec_view)
          val metr_view=itemView.findViewById&lt;TextView&gt;(R.id.metr_text_rec_view)
          val btn_rec_item=itemView.findViewById&lt;Button&gt;(R.id.btn_item_rec)
      }
  }
  </code></pre>
  
  <p>myactivity on create:</p>
  
  <pre><code>override fun onCreate(savedInstanceState: Bundle?) {
          super.onCreate(savedInstanceState)
          setContentView(R.layout.activity_profile)
          val toolbar: Toolbar = findViewById(R.id.toolbar)
          setSupportActionBar(toolbar)
  
          val fab: FloatingActionButton = findViewById(R.id.fab)
          fab.setOnClickListener { view -&gt;
              Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
                  .setAction("Action", null).show()
          }
          val drawerLayout: DrawerLayout = findViewById(R.id.drawer_layout)
          val navView: NavigationView = findViewById(R.id.nav_view)
          val toggle = ActionBarDrawerToggle(
              this, drawerLayout, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close
          )
          drawerLayout.addDrawerListener(toggle)
          toggle.syncState()
  
          //var intent=Intent(this,Profile::class.java)
          var us= User_info()
          us.name=intent.getStringExtra("username")
          us.image_url=intent.getStringExtra("image")
          user= User_info()
          this.user =us
          get_sales_list()
          var rec=findViewById&lt;RecyclerView&gt;(R.id.rec_sale)
          rec.layoutManager = LinearLayoutManager(this, LinearLayout.VERTICAL, false)
          rec.adapter=adapters
  
  
  
  
  
          navView.setNavigationItemSelectedListener(this)
      }
  </code></pre>
  
  <p>and get data fun:</p>
  
  <pre><code>fun get_sales_list()
      {
          var retrofit = Retrofit.Builder()
              .baseUrl("http://sobosha.ir/")
              .addConverterFactory(GsonConverterFactory.create())
              .build()
          val services=retrofit.create(Apiservices::class.java)
          val call =services.sale_agahi(user.name.toString())
          call.enqueue(object : Callback&lt;sales_list&gt; {
              override fun onResponse(call: Call&lt;sales_list&gt;, response: retrofit2.Response&lt;sales_list&gt;) {
                  var temp:sales_list= response.body()!!
                  arr_sale= temp
                  Log.d("arr_sale",arr_sale.list[0].phone.toString())
                  adapters=RecyclerSaleAdapter(arr_sale.list)
  
              }
              override fun onFailure(call: Call&lt;sales_list&gt;, t: Throwable) {
                  Toast.makeText(applicationContext,t.message,Toast.LENGTH_LONG).show()
  
              }
          })
      }
  </code></pre>
  
  <p>I have an error on rec.adapter=adapters</p>