Skip to content

Instantly share code, notes, and snippets.

View hackstarsj's full-sized avatar
🏠
Work from home

Sanjeev Kumar hackstarsj

🏠
Work from home
View GitHub Profile
@hackstarsj
hackstarsj / FragmentObserver.java
Created July 17, 2019 19:05 — forked from alexfu/FragmentObserver.java
Observer pattern for notifying Fragments of a ViewPager to update their views. This will update the current Fragment, as well as the off screen Fragments that are retained.
public class FragmentObserver extends Observable {
@Override
public void notifyObservers() {
setChanged(); // Set the changed flag to true, otherwise observers won't be notified.
super.notifyObservers();
}
}