wwu-pi / md2-framework

MD2 – Model-driven Mobile Development
Apache License 2.0
14 stars 10 forks source link

Application context holds activity-specific state #4

Closed sacnl closed 7 years ago

sacnl commented 11 years ago

While Activities are recreated when an app is restarted, Android keeps some things in memory, for example, MD2Application. MD2Application, however, contains references to UI elements (via mappings, possibly also validators) that are specific to one lifecycle. When an activity (but not MD2Application) is created again, the mappings point to stale UI elements and do not have any effect. The global context should not hold references to objects that will be recreated when the apps is newly started.

To see this effect in action, look at the simple app in wwu-pi/md2-testApps@85c2e8a4580eeda64ffdf5cd9931478f2b45ad1f

sacnl commented 11 years ago

This also leads to errors if an app consists of more than one activity and starts sub-activities multiple times.