title: Proper way to thread in kotlin
body: <p>I have thread code block which basically displays progress bar for 2 seconds then shows a recycler view. I wonder if there is more proper way to write this for example coroutines or rxjava. I tried coroutines but I got crashes.
  Code :</p>
  
  <pre><code> runOnUiThread {
              fabClose()
              isOpen = false
              rec_view.adapter=null
              progressBar.visibility = View.VISIBLE
  
          }
          val handler = Handler()
          val t = Timer()
          t.schedule(object: TimerTask() {
              override fun run() {
                  handler.post {
                          runOnUiThread {
                              imageRecognition()
                              progressBar.visibility = View.GONE
  
                          }
                  }
              }
          }, 2000)
  </code></pre>