Hey Dan,
First of all, thanks for answering and trying the code.
About your question, there are some reasons for which I prefer the add/remove behaviour:
- The less important, because I have many layers, and I was not sure about how many layers you could add to the map object without a loss of eficiency. Do you have any specific data about it?
Anyway, the two more importants reasons are the following:
- In my app I want to offer the user the option to add "manually" layers to the map, that means, the user will be capable to write the URL, and the app will create the new layer with this URL, and then will add it to the map. And in the same way, after that, the user will be able to remove it.
- I'm working with tpk's, and depending on the tpk's available in the device I will choose ones or anothers, that is, I don't know from the beginning which ones or how many I'll have.
To sum up, I need a dynamic behaviour about the layers in the map... I'm already using the "visibility pattern" for my base layers that always will be in the map, but I cannot do that for the others.
The worst thing is that I don't understand why the add/remove code does not work in some devices. And although you say that the preferred approach is setting the visibility, I assume that the add/remove should work too, otherwise which would be the point of add/remove operations?
Thanks in advanced, and looking forward the results of your tests
Jessica