I've been developing using the Avkon view switching architecture, as it seems the most flexible solution.

All tutorials and books I've read demonstrate Avkon view switching by creating a View which holds a single Container; the Container is created in DoActivateL and destroyed in DoDeactivateL.

However, this has a downside: when we switch from view A to view B, the container of view A is destroyed, and when we later switch back from view B to view A the container of view A is created from the scratch. This means that the view "forgets" such things as list indices (which can be really frustrating in applications with long lists / large grids).

So the question is: what is a good way of implementing such "memory" to views? At the moment I have two ideas:

1) In DoDeactivateL, store all important information from the Container in the View. This is pretty simple but creates an ugly duplication between Container and View data.

2) Don't destroy the Container in DoDeactivateL, but simply remove it from the stack. This means that the container stays always in the memory after the first (lazy) initialization. This has the downside that memory is wasted (though I have no idea how much), and that an additional "book keeping" flag has to be kept in the View indicating whether the container is showing or not.

- Mikko