1
내 RecyclerView
의 행에서 ProgressBar
및 다운로드Button
입니다. 이 버튼을 클릭하면 다운로드가 시작됩니다. ProgressBar
에 다운로드 진행률을 표시하고 싶습니다. 누구든지 나를 도울 수 있니?DownloadManager를 사용하여 RecyclerView에서 다운로드 진행 과정 표시
편집 :
내 다운로드 코드 :
@Override
public void onBindViewHolder(final DataHolder holder, final int position) {
final Item item = items.get(position);
holder.btnDownload.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String url = item.getLink();
DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url));
request.setDescription(item.getDescription());
request.setTitle(item.getTitle());
request.allowScanningByMediaScanner();
request.setNotificationVisibility(
DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, "file"+position+".pdf");
manager.enqueue(request);
}
});
몇 가지 코드를 게시하십시오. –