2

I am beginner in Android studio and I started learning the different Architecture components within the Android Jetpack. When dealing with data, I realized that in almost every tutorial or documentation the ViewModel class is used. It is always stated that one of the advantages of the class is that the data can survive configuration changes, and the example is always screen rotation. My question is for which other cases it is useful and also if there are other examples of configuration changes apart from screen rotation.

Thanks

Berni
  • 551
  • 10
  • 17

1 Answers1

2

if there are other examples of configuration changes apart from screen rotation

Yes, keyboard availability, and multi-window mode see

My question is for which other cases it is useful

That's its only purpose see. Before ViewModel, handling configuration changes in Android has to be done manually and add some performance issues. So the ViewModel class comes in handy.

aiqency
  • 1,015
  • 1
  • 8
  • 22