title: I am doing the Kotlin android basics course and I'm getting expecting member declaration on a simple line of code, I have no idea what to do
body: <p>Hi I'm new to kotlin and I'm working on the words dictionary app I accidentally deleted a line of code but managed to put it back in and now for some reason it's not working. The error is expecting member declaration. I'm guessing it's linked to line 118 of the code expecting top level declaration, it's just a curly bracket. PLease help</p>
  <pre><code>/**
   * Adapter for the [RecyclerView] in [DetailActivity].
   */
  class WordAdapter(private val letterId: String, context: Context) :
      RecyclerView.Adapter&lt;WordAdapter.WordViewHolder&gt;() {
  
      private val filteredWords: List&lt;String&gt;
  
      init {
          // Retrieve the list of words from res/values/arrays.xml
          val words = context.resources.getStringArray(R.array.words).toList()
  
          filteredWords = words
              // Returns items in a collection if the conditional clause is true,
              // in this case if an item starts with the given letter,
              // ignoring UPPERCASE or lowercase.
              .filter { it.startsWith(letterId, ignoreCase = true) }
              // Returns a collection that it has shuffled in place
              .shuffled()
              // Returns the first n items as a [List]
              .take(5)
              // Returns a sorted version of that [List]
              .sorted()
      }
  
      class WordViewHolder(val view: View) : RecyclerView.ViewHolder(view) {
          val button = view.findViewById&lt;Button&gt;(R.id.button_item)
      }
  
      override fun getItemCount(): Int = filteredWords.size
  
      /**
       * Creates new views with R.layout.item_view as its template
       */
      override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): WordViewHolder {
          val layout = LayoutInflater
              .from(parent.context)
              .inflate(R.layout.item_view, parent, false)
  
          // Setup custom accessibility delegate to set the text read
          layout.accessibilityDelegate = Accessibility
  
          return WordViewHolder(layout)
      }
  
      /**
       * Replaces the content of an existing view with new data
       */
      override fun onBindViewHolder(holder: WordViewHolder, position: Int) {
          holder.button.setOnClickListener {
              val queryUrl: Uri = **Uri.parse(&quot;${DetailActivity.SEARCH_PREFIX}${item}&quot;)&lt;---Unresolved reference item**
              val intent = Intent(Intent.ACTION_VIEW, queryUrl)
              **context.startActivity(intent)&lt;---Unresolved reference context**
  
          }
  
  
      }
          val item = filteredWords[position]&lt;--Unresolved reference position
          // Needed to call startActivity
          val context = holder.view.context &lt;--Unresolved reference holder
  
          // Set the text of the WordViewHolder
          **holder.button.text = item**  **&lt;---This line is the error Expecting member declaration**
  
      }
      // Setup custom accessibility delegate to set the text read with
      // an accessibility service
      companion object Accessibility : View.AccessibilityDelegate() {
          @RequiresApi(Build.VERSION_CODES.LOLLIPOP)
          override fun onInitializeAccessibilityNodeInfo(
              host: View?,
              info: AccessibilityNodeInfo?
          ) {
              super.onInitializeAccessibilityNodeInfo(host, info)
              // With `null` as the second argument to [AccessibilityAction], the
              // accessibility service announces &quot;double tap to activate&quot;.
              // If a custom string is provided,
              // it announces &quot;double tap to &lt;custom string&gt;&quot;.
              val customString = host?.context?.getString(R.string.look_up_word)
              val customClick =
                  AccessibilityNodeInfo.AccessibilityAction(
                      AccessibilityNodeInfo.ACTION_CLICK,
                      customString
                  )
              info?.addAction(customClick)
          }
      }
  }          &lt;------Here is line 118 Expecting a top level declaration
  </code></pre>