开发者

3 instances of MapActivity

开发者 https://www.devze.com 2023-03-18 23:39 出处:网络
It states clearly in the Maps API that only one MapActivity per process is allowed. My problem is i need 3, it\'s not necessarily 3 Activities but it is 3 instances.

It states clearly in the Maps API that only one MapActivity per process is allowed. My problem is i need 3, it's not necessarily 3 Activities but it is 3 instances. I created a Travell agent app that allows you to book hotels and activities. focusing for a second in the hotels feature of my app, when you search hotels you can, naturally, see the all on the map, this is the first instance of the MapActivity i need, to show all hotels. If you choose hotel either form the ListActivity or from the MapActivity you can see that hotel's info in HotelInfoActivity. the hotelInfoActivity also has reference to a MapActivity that lets you see that specific hotel on the map without any other hotels.... (next step would be to add routes to that as well, but that feature is not in development just yet).

The bugs happen when you do the following scenario:

  1. you enter the map of all the hotels
  2. you get into the hotel info
  3. from the HotelInfoActivity you get into t开发者_C百科he MapActivity to see the hotel on the map ( I start the same activity but with intent with different data which is detected by my MapActivity).
  4. till this point everything is ok.
  5. i press on back twice (back to HotelInfoActivity,then back to MapActivity of All Hotels).
  6. i see the previous (single hotel) MapActivity.

Is there is any way around that issue ? it's great that i have two instances of the activity on the activities stack so i can navigate back to every instance, but how can i prevent them to pass states from one instance to another ????

(BTW the third instance is AFTER you've reserved the hotel you have the ability to see it on the map, but i don't have problems there for some reason).


Is there is any way around that issue ?

Only have one MapActivity, as the documentation states. You do not need more than one MapActivity for the scenario you have described. Change your overlays and map center/zoom levels based upon user interaction (e.g., icon taps and BACK button).

0

精彩评论

暂无评论...
验证码 换一张
取 消