com.google.android.maps
Class MapActivity
java.lang.Object
android.content.Context
android.content.ContextWrapper
android.view.ContextThemeWrapper
android.app.Activity
com.google.android.maps.MapActivity
- All Implemented Interfaces:
- ComponentCallbacks, KeyEvent.Callback, LayoutInflater.Factory, View.OnCreateContextMenuListener, Window.Callback
public abstract class MapActivity
- extends Activity
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.
| Fields inherited from class android.content.Context |
ACTIVITY_SERVICE, ALARM_SERVICE, AUDIO_SERVICE, BIND_AUTO_CREATE, BIND_DEBUG_UNBIND, CLIPBOARD_SERVICE, CONNECTIVITY_SERVICE, CONTEXT_IGNORE_SECURITY, CONTEXT_INCLUDE_CODE, KEYGUARD_SERVICE, LAYOUT_INFLATER_SERVICE, LOCATION_SERVICE, MODE_APPEND, MODE_PRIVATE, MODE_WORLD_READABLE, MODE_WORLD_WRITEABLE, NOTIFICATION_SERVICE, POWER_SERVICE, SEARCH_SERVICE, SENSOR_SERVICE, TELEPHONY_SERVICE, VIBRATOR_SERVICE, WALLPAPER_SERVICE, WIFI_SERVICE, WINDOW_SERVICE |
|
Method Summary |
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. |
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. |
protected void |
onCreate(Bundle icicle)
Here we initialize static factories, create the map object and
the traffic service, but do not begin any threads. |
protected void |
onDestroy()
Stops all our threads and frees all our resources. |
void |
onNewIntent(Intent newIntent)
This is called for activities that set launchMode to "singleTop" in
their package, or if a client used the FLAG_ACTIVITY_SINGLE_TOP
flag when calling startActivity(Intent). |
protected void |
onPause()
Pauses threads such as the traffic service, because we don't
want it running forever in the background. |
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". |
| Methods inherited from class android.app.Activity |
addContentView, closeOptionsMenu, createPendingResult, dismissDialog, dispatchKeyEvent, dispatchTouchEvent, dispatchTrackballEvent, finalize, findViewById, finish, finishActivity, finishActivityFromChild, finishFromChild, getApplication, getCallingActivity, getCallingPackage, getChangingConfigurations, getComponentName, getCurrentFocus, getInstanceCount, getIntent, getLastNonConfigurationInstance, getLayoutInflater, getLocalClassName, getMenuInflater, getParent, getPreferences, getRequestedOrientation, getSystemService, getTaskId, getTitle, getTitleColor, getVolumeControlStream, getWallpaperDesiredMinimumHeight, getWallpaperDesiredMinimumWidth, getWindow, getWindowManager, isChild, isFinishing, isTaskRoot, managedQuery, moveTaskToBack, onActivityResult, onApplyThemeResource, onChildTitleChanged, onConfigurationChanged, onContentChanged, onContextItemSelected, onContextMenuClosed, onCreateContextMenu, onCreateDescription, onCreateDialog, onCreateOptionsMenu, onCreatePanelMenu, onCreatePanelView, onCreateThumbnail, onCreateView, onKeyDown, onKeyMultiple, onKeyUp, onLowMemory, onMenuItemSelected, onMenuOpened, onOptionsItemSelected, onOptionsMenuClosed, onPanelClosed, onPostCreate, onPostResume, onPrepareDialog, onPrepareOptionsMenu, onPreparePanel, onRestart, onRestoreInstanceState, onRetainNonConfigurationInstance, onSaveInstanceState, onSearchRequested, onStart, onStop, onTitleChanged, onTouchEvent, onTrackballEvent, onWindowAttributesChanged, onWindowFocusChanged, openContextMenu, openOptionsMenu, registerForContextMenu, removeDialog, requestWindowFeature, runOnUiThread, setContentView, setContentView, setContentView, setDefaultKeyMode, setFeatureDrawable, setFeatureDrawableAlpha, setFeatureDrawableResource, setFeatureDrawableUri, setIntent, setPersistent, setProgress, setProgressBarIndeterminate, setProgressBarIndeterminateVisibility, setProgressBarVisibility, setRequestedOrientation, setResult, setResult, setSecondaryProgress, setTitle, setTitle, setTitleColor, setVolumeControlStream, showDialog, startActivity, startActivityForResult, startActivityFromChild, startActivityIfNeeded, startManagingCursor, startNextMatchingActivity, startSearch, stopManagingCursor, takeKeyEvents, unregisterForContextMenu |
| Methods inherited from class android.content.ContextWrapper |
bindService, checkCallingOrSelfPermission, checkCallingOrSelfUriPermission, checkCallingPermission, checkCallingUriPermission, checkPermission, checkUriPermission, checkUriPermission, clearWallpaper, createPackageContext, databaseList, deleteDatabase, deleteFile, enforceCallingOrSelfPermission, enforceCallingOrSelfUriPermission, enforceCallingPermission, enforceCallingUriPermission, enforcePermission, enforceUriPermission, enforceUriPermission, fileList, getApplicationContext, getAssets, getBaseContext, getCacheDir, getClassLoader, getContentResolver, getDatabasePath, getDir, getFilesDir, getFileStreamPath, getMainLooper, getPackageCodePath, getPackageManager, getPackageName, getPackageResourcePath, getResources, getSharedPreferences, getWallpaper, grantUriPermission, openFileInput, openFileOutput, openOrCreateDatabase, peekWallpaper, registerReceiver, registerReceiver, removeStickyBroadcast, revokeUriPermission, sendBroadcast, sendBroadcast, sendOrderedBroadcast, sendOrderedBroadcast, sendStickyBroadcast, setWallpaper, setWallpaper, startInstrumentation, startService, stopService, unbindService, unregisterReceiver |
MapActivity
public MapActivity()
onCreate
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().
- Overrides:
onCreate in class Activity
- 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.- See Also:
onStart(),
onSaveInstanceState(Bundle),
onRestoreInstanceState(Bundle),
onPostCreate(Bundle)
onNewIntent
public void onNewIntent(Intent newIntent)
- This is called for activities that set launchMode to "singleTop" in
their package, or if a client used the FLAG_ACTIVITY_SINGLE_TOP
flag when calling startActivity(Intent). In either case, when the
activity is re-launched while at the top of the activity stack instead
of a new instance of the activity being started, onNewIntent() will be
called on the existing instance with the Intent that was used to
re-launch it.
An activity will always be paused before receiving a new intent, so
you can count on onResume() being called after this method.
Note that getIntent() still returns the original Intent. You
can use setIntent(Intent) to update it to this new Intent.
- Overrides:
onNewIntent in class Activity
- Parameters:
newIntent - The new intent that was started for the activity.- See Also:
getIntent(),
setIntent(Intent),
onResume()
onResume
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.
- Overrides:
onResume in class Activity
- See Also:
onRestoreInstanceState(Bundle),
onRestart(),
onPostResume(),
onPause()
onPause
protected void onPause()
- Pauses threads such as the traffic service, because we don't
want it running forever in the background. Also saves
preferences.
- Overrides:
onPause in class Activity
- See Also:
onResume(),
onSaveInstanceState(Bundle),
onStop()
onDestroy
protected void onDestroy()
- Stops all our threads and frees all our resources.
- Overrides:
onDestroy in class Activity
- See Also:
onPause(),
onStop(),
finish(),
isFinishing()
isRouteDisplayed
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.
isLocationDisplayed
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.
Please submit a feedback, bug or feature