【发布时间】:2018-07-17 05:28:21
【问题描述】:
在我的模块中,我传递了 arraylist 投掷意图。但是当我打开我的活动时,它会自动添加。当我尝试在父活动的 onResume() 中清除我的数组列表时,似乎出现了这种类型的错误:-
应用程序的 PagerAdapter 更改了适配器的内容,而没有调用 PagerAdapter#notifyDataSetChanged!
我的代码在这里:-
这是PreExamActivity.kt这里是考试开始按钮的点击事件。
startExam.setOnClickListener {
//getMarks()
calculation()
Common.examqueList = null
if (numOfQueInSelectedChapter > totalQuestion) {
val intent = Intent(this, ExamActivity::class.java)
Common.examqueList = examQueList
startActivity(intent)
} else {
Toast.makeText(this, "Check yr question", Toast.LENGTH_SHORT).show()
}
}
override fun onResume() {
super.onResume()
Common.examqueList?.clear()
}
这是我的 ExamActivity.kt** :-
queArray = Common.examqueList
val adpter: PagerAdapter = ExamQuestionPageView(this, queArray!!, question_img_path)
qPager.adapter = adpter
【问题讨论】:
标签: android arraylist kotlin android-viewpager