Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onProgressChange not called #51

Open
ntaloventi opened this issue Jul 28, 2017 · 1 comment
Open

onProgressChange not called #51

ntaloventi opened this issue Jul 28, 2017 · 1 comment

Comments

@ntaloventi
Copy link

ntaloventi commented Jul 28, 2017

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
<com.daimajia.numberprogressbar.NumberProgressBar android:id="@+id/npb" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_margin="10dp" android:padding="10dp" custom:progress_max="100" style="@style/NumberProgressBar_Warning_Red"/>

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

@adougherty
Copy link

I'm a little late to the party, but the issue is with setProgress. It does not call onProgressChangeListener. onProgerssChange will only be called as a result of incrementProgressBy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants