title: Nothing happens after startActivity in Android with Kotlin
body: <p>I have a very weird problems about android "startActivity()" method. The new Activity is not started after I called "startActivity()" method.</p>
  
  <p>This is my code :</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>val ini = this
  adapter.setOnDetailListener(object : DetailListener {
      override fun onDetail(key: String) {
          val destination = Intent(ini, DetailKontrakanActivity::class.java)
  
          Log.e("ANAK_KOST","onDetailKontrakan")
  
  
          destination.putExtra("KEY",key)
  
          ini.startActivity(destination)
      }
  })</code></pre>
  </div>
  </div>
  </p>
  
  <p>This is my log :</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>2018-09-27 14:12:38.621 478-2366/? E/ANDR-PERF-MPCTL: Invalid profile no. 0, total profiles 0 only
  2018-09-27 14:12:38.770 17514-17514/? E/ANAK_KOST: goToDetailKontrakan
  2018-09-27 14:12:38.771 17514-17514/? E/ANAK_KOST: onDetailKontrakan
  2018-09-27 14:12:38.771 17514-17514/? I/Timeline: Timeline: Activity_launch_request time:63333082
  2018-09-27 14:12:38.776 1546-2979/? I/ActivityManager: START u0 {cmp=galihlprakoso.com.anakkostv3/.View.ReusableActivities.DetailKostActivity (has extras)} from uid 10391 on display 0
  2018-09-27 14:12:38.784 1546-2979/? D/ActivityTrigger: ActivityTrigger activityPauseTrigger 
  2018-09-27 14:12:38.789 17514-17514/? I/FIAM.Headless: Removing display event listener
  2018-09-27 14:12:38.796 2703-2819/? I/WtProcessController: MOVE TO FOREGROUND: galihlprakoso.com.anakkostv3 10391
  2018-09-27 14:12:38.796 2703-2819/? I/WtProcessController: FOREGROUND INFO: name=galihlprakoso.com.anakkostv3 uid=10391 pid=17514 TaskId:265
  2018-09-27 14:12:38.797 1546-2979/? I/Timeline: Timeline: App_transition_ready time:63333108</code></pre>
  </div>
  </div>
  </p>
  
  <p>The Log "onDetailKontrakan" is printed on Log but The startActivity() method is not calling the new Activity.</p>
  
  <p>I used that code on some Fragments it works, but not work in activity.</p>
  
  <p>This is my whole Adapter Class Code :</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>class DataKostAdapter(var listKost: ArrayList&lt;Kost&gt;, private val activity: Context,private val tipe:Int) : RecyclerView.Adapter&lt;DataKostAdapter.DataKostViewHolder&gt;() {
  
      companion object {
  
          val CRUD = 0
          val NO_CRUD = 1
  
      }
  
      private var hapusListener:HapusListener? = null
      private var detailListener:DetailListener? = null
      private var backupListKost:ArrayList&lt;Kost&gt; = ArrayList()
  
  
      init{
          listKost.forEach { kost -&gt;
              backupListKost.add(kost)
          }
      }
  
  
      override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): DataKostViewHolder {
          val binding = DataBindingUtil.inflate&lt;ItemRvDataKostBinding&gt;(LayoutInflater.from(parent.context),
                          R.layout.item_rv_data_kost,parent,false)
  
  
          return DataKostViewHolder(binding)
      }
  
      override fun onBindViewHolder(holder: DataKostViewHolder, position: Int) {
          val kost = listKost[position]
  
          holder.binding.kost = kost
          holder.binding.adapter = this
  
          if (kost.gambar.length != 0) {
              Glide.with(activity).load(kost.gambar).into(holder.binding.itemRvDataKostImg)
          }
  
          holder.binding.itemRvDataKostWrapper
                  .setOnClickListener(object : View.OnClickListener{
                      override fun onClick(p0: View?) {
                          goToDetailKost(kost)
                      }
                  })
  
          if(tipe == NO_CRUD){
              holder.binding.itemRvDataKostEdit.visibility = View.GONE
              holder.binding.itemRvDataKostHapus.visibility = View.GONE
          }
      }
  
      override fun getItemCount(): Int {
          return listKost.size
      }
  
      fun goToEditKost(kost: Kost) {
          val intent = Intent(activity, FormKostActivity::class.java)
  
          intent.putExtra(FormKostActivity.TIPE_FORM,FormKostActivity.EDIT)
          intent.putExtra("KEY",kost.key)
  
          activity.startActivity(intent)
      }
  
      fun setOnHapusListener(hapusListener: HapusListener){
          this.hapusListener = hapusListener
      }
  
      fun setOnDetailListener(detailListener: DetailListener){
          this.detailListener = detailListener
      }
  
      fun hapusKost(kost: Kost){
          if(hapusListener!=null){
              hapusListener!!.onHapus(kost.key)
          }
      }
  
      fun goToDetailKost(kost: Kost) {
  
          Log.e("ANAK_KOST","goToDetailKost")
  
          if(detailListener!=null){
              detailListener!!.onDetail(kost.key)
          }
      }
  
      fun search(query:String){
  
          listKost.clear()
  
          if(query == "" || query.isEmpty()){
  
              backupListKost.forEach { kost -&gt;
                  listKost.add(kost)
              }
  
          }else{
  
              backupListKost.forEach { kost -&gt;
  
                  if(kost.nama.contains(query, ignoreCase = true)){
  
                      listKost.add(kost)
                  }
  
              }
          }
  
          notifyDataSetChanged()
      }
  
  
      fun sortByHargaSewa(){
  
          val temp = ArrayList&lt;Kost&gt;()
  
          val length = listKost.size
  
          Log.e("ANAK_KOST","Length :"+length)
  
          if(length&gt;1){
              while(true){
  
                  var chosen = 0
  
                  for(i in 0..listKost.size-1){
  
                      val kost = listKost.get(i)
                      val termurah = listKost.get(chosen)
  
                      if(kost.harga_sewa &lt;= termurah.harga_sewa){
                          chosen = i
                      }
  
                  }
  
                  temp.add(listKost.get(chosen))
                  listKost.removeAt(chosen)
  
  
                  if(temp.size == length){
                      break
                  }
              }
  
              listKost = temp
              notifyDataSetChanged()
          }
  
      }
  
      fun sortByRating(){
  
          val temp = ArrayList&lt;Kost&gt;()
  
          val length = listKost.size
  
          if(length&gt;1){
              while(true){
  
                  var chosen = 0
  
                  for(i in 0..listKost.size-1){
  
                      val kost = listKost.get(i)
                      val terpopuler = listKost.get(chosen)
  
                      if(kost.rating &lt;= terpopuler.rating){
                          chosen = i
                      }
  
                  }
  
                  temp.add(listKost.get(chosen))
                  listKost.removeAt(chosen)
  
                  if(temp.size==length){
                      break
                  }
  
              }
  
              listKost = temp
              notifyDataSetChanged()
          }
      }
  
  
  
  
  
      inner class DataKostViewHolder(internal var binding: ItemRvDataKostBinding) : RecyclerView.ViewHolder(binding.root)
  
  }</code></pre>
  </div>
  </div>
  </p>