I was surprised to see a couple major shortcomings in the design of MapView
and MapActivity.

First, MapView requires itself to be hosted in a MapActivity. According to
the documentation,

A MapView can only be constructed (or inflated) by a
MapActivity<http://code.google.com/android/add-ons/google-apis/reference/com/google/android/maps/MapActivity.html>.
> This is because it depends on threads which access the network and
> filesystem in the background; these threads must be shepherded by the
> lifecycle management in 
> MapActivity<http://code.google.com/android/add-ons/google-apis/reference/com/google/android/maps/MapActivity.html>.
> Tiles are cached on the filesystem in your application's directory. The
> cache is auto-managed so you don't need to do anything with it, and can
> delete it at any time.


This seems pretty weak considering that WebView is at least, if not more
complicated, than MapView and does not have such a requirement. This
limitation means that the application developer is locked into a particular
base class when hosting a map view. Consider the thought experiment about
what would happen if other controls followed the same pattern. If WebView
required itself to be hosted in a WebActivity and ImageView required itself
to be hosted in an ImageActivity, it would not be possible to construct a
user interface that showed a map, a web page, and an image in the same view.
There are other engineering solutions to solve the problem of sharing
various network and file system threads without requiring a specific base
class.

Second, even more limiting is that there can only be a single MapActivity in
the process. According to the documentation,

Only one MapActivity is supported per process. Multiple MapActivities
> running simultaneously are likely to interfere in unexpected and undesired
> ways.


This means I am forced in my app to choose a single place where a map can be
displayed. Unfortunately, there are multiple places in the app where it is
interesting to show a map. The iphone version of the app shows maps in
multiple places, but this is not possible with the android version because
of this limitation.

Has anybody else had to make compromises to their application because of
these limitations? Is the Google engineer who owns this API aware of
the limitations? Are there any proposals to fix it? Is the best workaround
simply to use a WebView that uses the javascript API? Thanks.

-Jon

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to