2

I have a listview that each items have a progressbar that update every seconds, so I used notifyDataSetChanged() to update each item of list view, in this state every things is OK, But I also have a button on this item of list view that has its setOnClickListener , as listview notifyDataSetChanged() is calling every second, this button clicking not working.

So, Can I update just that ProgressBar? not whole the itemView?

or any solution to solve this problem?

CODE

private fun createDownloadingItemView(video: Video): View {
    val view = UIHelper.createLayout(this@DownloadManagerPage, R.layout.layout_downloading_item)
    view.downloadProgressBar.progress = video.downloadProgress

    view.deleteFileImageView.setOnClickListener {
        showDeleteDialog(video)
    }

    return view
}

Interface

override fun onDownloadChanged(progressPercent: Int) {
    downloadFiles = Gson().fromJson<ArrayList<Video>>(
        ValueDB.downloadFiles,
        object : TypeToken<List<Video>>() {}.type
    )

    downloadingFiles.clear()
    downloadingFiles.addAll(downloadFiles.filter { downloadFile -> downloadFile.isDownloading })

    downloadingAdapter?.notifyDataSetChanged()
}
SadeQ digitALLife
  • 1,403
  • 4
  • 16
  • 22

0 Answers0