记录解决fragment中onActivityResult不回调用的问题

开始入坑kotlin了

解决办法:在宿主activity中

  override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
        super.onActivityResult(requestCode, resultCode, data)
        if (supportFragmentManager.fragments.size > 0) {
            var fragments:List?= supportFragmentManager.fragments
            val mIterator = fragments?.iterator()
            while (mIterator!!.hasNext()) {
                val next = mIterator.next()
                next.onActivityResult(requestCode, resultCode, data)
            }
        }

    }

 

你可能感兴趣的:(kotlin踩坑)