1

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();
}
Laurel
  • 5,965
  • 14
  • 31
  • 57
duszyn_
  • 33
  • 5
  • Found an answer here https://stackoverflow.com/questions/4348032/android-progressbar-does-not-update-progress-view-drawable – duszyn_ Feb 27 '22 at 20:38

0 Answers0