Visual problem with Android Studio progress bar

Viewed 82

I added an option to click on it in activity number 1 that saves sharedpreferences, and it should restart progressbar progress in activity nr 2, but the problem is that even when I go to activity nr 2 and setProgress(0) is called and getProgress returns 0, progress on progressbar is still there, and only after restarting app progressbar updates. What should I do to repair it?

Code on click in activity nr 1

sharedPreferences.edit().putBoolean("restarted", true).apply();

Code in activity nr 2 to set progressbar

if(sharedPreferences.getBoolean("restarted", false)) {
    progress.setProgress(0);
    sharedPreferences.edit().putBoolean("restarted", false).apply();
}
0 Answers
Related