Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does the android:configChanges="screenSize" attribute do?

I would like to know what the above mentioned attribute for an Activity in the AndroidManifest.xml does and why it (would be) needed?

I have already read the Android documentation about this topic and the explaination is not quite clear to me. Id like to know an example case WHY I would have to set this attribute.

like image 577
Philipp Jahoda Avatar asked Aug 04 '14 14:08

Philipp Jahoda


1 Answers

As you may have known every time a parameter of the phone changes the system rebuilds the whole Activity in order to load the new resources. On of these parameters is the screen size, which can change on a phone, as the rotation of the phone changes it.

If you define android:configChanges in your manifest you can have full control over your application, which means that the system won't destroy your Activity, it only calls the onConfiguratinChanged method of it. This way you have to manage the resizeing of the screen.

like image 200
pshegger Avatar answered Nov 15 '22 05:11

pshegger