daimajia / daimajia/NumberProgressBar

onProgressChange not called

Open
#51 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
6.1k
Forks
1.4k
PR merge metrics
No merged PRs in 30d

Description

hi, i'm using your library to download file and when its reached 100% install apk or view image, but onProgressChange not being called, how to know which part that was miss by me?

xml
``

change listener
`@Override
public void onProgressChange(int current, int max) {
if (current == max){
//instal on apps
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
installOnDevice();
npb.setProgress(0);
}
}, 2000);
}
}`

in asynctask
`protected void onProgressUpdate(String... progress) {
// setting progress percentage
npb.setProgress(Integer.parseInt(progress[0]));
}`

install or view
`private void installOnDevice(){
File downloadedFile = new File(Environment.getExternalStorageDirectory() + "/" + fileName);
Log.d(TAG, "filename: " + fileName);
if (fileName.contains(".apk")){
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(downloadedFile), "application/vnd.android.package-archive");
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
}
else if (fileName.contains(".jpg")){
Log.d(TAG, "set image to image view");
Glide.with(getActivity()).load(downloadedFile).into(ivBackground);
}
enableTap = true;
}`

thanks b4

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.