Android
com.google.android.maps
public abstract class

com.google.android.maps.MapActivity

java.lang.Object
android.content.Context
android.content.ContextWrapper
android.view.ContextThemeWrapper
android.app.Activity ComponentCallbacks KeyEvent.Callback LayoutInflater.Factory View.OnCreateContextMenuListener Window.Callback
com.google.android.maps.MapActivity

Base class with code to manage the boring necessities of any activity that displays a MapView. Activity responsibilities include:

  • Activity lifecycle management
  • Setup and teardown of services behind a MapView

A subclass should create its own MapView in onCreate(Bundle), either with the MapView constructor (then add it to a layout View with addView(View)) or leave the construction (and layout) up to inflation from the layout XML.

This is not a standard package in the Android library. In order to use it, you must add the following XML element, as a child of the application element, in your AndroidManifest.xml file:

<uses-library android:name="com.google.android.maps" />

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

Summary

Constants inherited from class android.app.Activity
Constants inherited from class android.content.Context

Public Constructors

            MapActivity()

Protected Methods

          boolean  isLocationDisplayed()
For accounting purposes, the server needs to know whether or not you are currently displaying any kind of sensor-based estimation of the device's current location.
abstract          boolean  isRouteDisplayed()
For accounting purposes, the server needs to know whether or not you are currently displaying any kind of route information, such as a set of driving directions.
          void  onCreate(Bundle icicle)
Here we initialize static factories, create the map object and the traffic service, but do not begin any threads.
          void  onDestroy()
Stops all our threads and frees all our resources.
          void  onPause()
Pauses threads such as the traffic service, because we don't want it running forever in the background.
          void  onResume()
Here we tell the map to "predraw", which front-loads fetching and decoding, so that the first draw will appear more "atomic".
Methods inherited from class android.app.Activity
Methods inherited from class android.view.ContextThemeWrapper
Methods inherited from class android.content.ContextWrapper
Methods inherited from class android.content.Context
Methods inherited from class java.lang.Object
Methods inherited from interface android.content.ComponentCallbacks
Methods inherited from interface android.view.KeyEvent.Callback
Methods inherited from interface android.view.LayoutInflater.Factory
Methods inherited from interface android.view.View.OnCreateContextMenuListener
Methods inherited from interface android.view.Window.Callback

Details

Public Constructors

public MapActivity()

Protected Methods

protected boolean isLocationDisplayed()

For accounting purposes, the server needs to know whether or not you are currently displaying any kind of sensor-based estimation of the device's current location. By default, this method returns true if a subclass of MyLocationOverlay has been added through getOverlays() and has location enabled; however, subclasses which display the location by any other means must overide this method to truthfully report this information, or be in violation of our terms of use. TODO: provide link

Returns

  • True if user location information is displayed; false otherwise.

protected abstract boolean isRouteDisplayed()

For accounting purposes, the server needs to know whether or not you are currently displaying any kind of route information, such as a set of driving directions. Subclasses must implement this method to truthfully report this information, or be in violation of our terms of use. TODO: provide link

Returns

  • True if route information is displayed; false otherwise.

protected void onCreate(Bundle icicle)

Here we initialize static factories, create the map object and the traffic service, but do not begin any threads. The subclass should create (or inflate) its MapView object after calling through to super.onCreate().

Parameters

icicle If the activity is being re-initialized after previously being shut down then this Bundle contains the data it most recently supplied in onSaveInstanceState(Bundle). Note: Otherwise it is null.

protected void onDestroy()

Stops all our threads and frees all our resources.

protected void onPause()

Pauses threads such as the traffic service, because we don't want it running forever in the background. Also saves preferences.

protected void onResume()

Here we tell the map to "predraw", which front-loads fetching and decoding, so that the first draw will appear more "atomic". Start our threads: the traffic service and resume the MapView which will register for the updates.
Copyright 2007 Google Inc. Build 0.9_r1-98467 - 14 Aug 2008 18:48