kotlin使用viewpager+fragment报错 java.lang.IllegalStateException: Fragment already added
private var fileUrl: String = ""
private var taskIds: String = ""
override fun onActivityCreated(savedInstanceState: Bundle?) {
super.onActivityCreated(savedInstanceState)
fileUrl = activity!!.intent.getStringExtra("fileUrl")
taskIds = activity!!.intent.getStringExtra("taskIds")
}
如果这样使用 那么如果getStringExtra()返回的是null 就会报java.lang.IllegalStateException: Fragment already added