title: Unable to access variable from innerclass : Kotlin android
body: <p>I am new to Kotlin development in android. here I am trying to access a variable defined in a class from it's inner class as below. </p>
  
  <pre><code>class MainActivity : AppCompatActivity() {
  
      var frags: MutableList&lt;Fragment&gt; = mutableListOf()
  
  //.............onCreate and other methods ....
  
      internal class CustAdapter(var arrayList: ArrayList&lt;NavigationData&gt;) : RecyclerView.Adapter&lt;CustAdapter.MyViewHolder&gt;() {
      override fun onBindViewHolder(holder: MyViewHolder?, position: Int) {
          holder!!.bindItems(arrayList[position])
      }
  
      override fun getItemCount(): Int {
          return arrayList.size
      }
      override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): CustAdapter.MyViewHolder {
          val v = LayoutInflater.from(parent.context).inflate(R.layout.navigation_item, parent, false)
          return MyViewHolder(v)
      }
  
      class MyViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
          fun bindItems(data: NavigationData) {
  
  
              itemView.setOnClickListener {
                     frags.add(BoardFrag()) ///// here i'm getting error "unresolved symbol"
  
              }
          }
      }
  }    
  }
  </code></pre>
  
  <p>inside inner class <code>MyViewHolder</code> it is not allowing me to access any variable of outer scope.</p>
  
  <p>even I'm unable to access view ids imported from <code>
  import kotlinx.android.synthetic.main.activity_main.*</code> inside inner class methods.</p>
  
  <p>I was able to access variables in such a way in <code>java</code> but i have read many question on stackoverflow but i didn't get answer yet. </p>