com.mapbar.android.maps
Class MapActivity

java.lang.Object
  extended by android.content.Context
      extended by android.content.ContextWrapper
          extended by android.view.ContextThemeWrapper
              extended by android.app.Activity
                  extended by com.mapbar.android.maps.MapActivity
All Implemented Interfaces:
android.content.ComponentCallbacks, android.view.KeyEvent.Callback, android.view.LayoutInflater.Factory, android.view.View.OnCreateContextMenuListener, android.view.Window.Callback

public abstract class MapActivity
extends android.app.Activity

MapActivity是一个基类,它使用代码去管理任何一个Activity繁琐的事务,它的责任包括:

一个子类应当在onCreate(android.os.Bundle) 创建它自己的MapView, 或使用MapView的构造函数(然后用ViewGroup.addView(View)把它加入到布局视图里),或把这个构造(和Layout)留给Layout XML的inflation.

MapAcitivity并不是Andriod库中标准的Package。为了使用它,你必须在你的AndroidManifest.xml文件中添加下面的XML元素做为application元素的子元素。

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

每个进程只支持一个MapAcitivity。多个MapActivity同时运行很可能让它们之间的交互变得不可预期。


 

Fields inherited from class android.app.Activity
DEFAULT_KEYS_DIALER, DEFAULT_KEYS_DISABLE, DEFAULT_KEYS_SEARCH_GLOBAL, DEFAULT_KEYS_SEARCH_LOCAL, DEFAULT_KEYS_SHORTCUT, FOCUSED_STATE_SET, RESULT_CANCELED, RESULT_FIRST_USER, RESULT_OK
 
Fields inherited from class android.content.Context
ACTIVITY_SERVICE, ALARM_SERVICE, APPWIDGET_SERVICE, AUDIO_SERVICE, BIND_AUTO_CREATE, BIND_DEBUG_UNBIND, BLUETOOTH_SERVICE, CLIPBOARD_SERVICE, CONNECTIVITY_SERVICE, CONTEXT_IGNORE_SECURITY, CONTEXT_INCLUDE_CODE, INPUT_METHOD_SERVICE, 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, STATUS_BAR_SERVICE, TELEPHONY_SERVICE, VIBRATOR_SERVICE, WALLPAPER_SERVICE, WIFI_SERVICE, WINDOW_SERVICE
 
Constructor Summary
MapActivity()
           
 
Method Summary
protected  boolean isLocationDisplayed()
          为了计算的目的,服务器需要知道Activity是否正在显示某种对终端当前位置基于传感器的估算。
protected abstract  boolean isRouteDisplayed()
          为了计算的目的,服务器需要知道你当前是否正在显示任何一种路线信息,例如一组驾车方向指示。
protected  void onCreate(android.os.Bundle icicle)
          此函数初始化静态工厂类,创建地图对象和交通服务,但不启动任何线程。
protected  void onDestroy()
          终止所有线程,释放所有资源。
 void onNewIntent(android.content.Intent newIntent)
           
protected  void onPause()
          暂停线程例如交通服务,因为我们不想让它永远在后台运行。
protected  void onResume()
          告诉地图去"提前绘制",提前装载和解码,使得第一次绘制显得更"原子化"。
 
Methods inherited from class android.app.Activity
addContentView, closeContextMenu, 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, hasWindowFocus, isChild, isFinishing, isTaskRoot, managedCommitUpdates, managedQuery, 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, onUserInteraction, onUserLeaveHint, 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, setVisible, setVolumeControlStream, showDialog, startActivity, startActivityForResult, startActivityFromChild, startActivityIfNeeded, startManagingCursor, startNextMatchingActivity, startSearch, stopManagingCursor, takeKeyEvents, unregisterForContextMenu
 
Methods inherited from class android.view.ContextThemeWrapper
attachBaseContext, getTheme, setTheme
 
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
 
Methods inherited from class android.content.Context
getString, getString, getText, obtainStyledAttributes, obtainStyledAttributes, obtainStyledAttributes, obtainStyledAttributes
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MapActivity

public MapActivity()
Method Detail

onCreate

protected void onCreate(android.os.Bundle icicle)
此函数初始化静态工厂类,创建地图对象和交通服务,但并不开启任何线程。子类在调用super.onCreate()后应该创建自身的MapView 对象。

Overrides:
onCreate in class android.app.Activity

onNewIntent

public void onNewIntent(android.content.Intent newIntent)
Overrides:
onNewIntent in class android.app.Activity

onResume

protected void onResume()
此函数通知地图去"提前绘制",即提前装载和解码,以便于第一次绘制显得更加"原子化"。启动交通服务线程,恢复要注册更新的MapView。

Overrides:
onResume in class android.app.Activity

onPause

protected void onPause()
暂停例如交通服务的线程,因为我们不想让它永远在后台运行。同时存储偏好设置。

Overrides:
onPause in class android.app.Activity

onDestroy

protected void onDestroy()
终止所有线程,释放所有资源。

Overrides:
onDestroy in class android.app.Activity

isRouteDisplayed

protected abstract boolean isRouteDisplayed()
为了计算的目的,服务器需要知道是否正在显示任何一种路由信息,例如一组驾车导向标志。子类必须实现这个方法以便真正报告这个信息,否则将违反使用条款。

Returns:
如果正在显示路线信息返回true,否则返回false。

isLocationDisplayed

protected boolean isLocationDisplayed()
为了计算的目的,服务器需要知道你是否正在显示任何一种对终端当前位置基于传感器的位置估算。默认情况下,如果MyLocationOverlay的一个子类通过MapView.getOverlays()被添加,而且已经启动定位功能,这个函数返回true;但是,子类必须覆盖掉这个方法以便真实的报告这个信息,否则违反使用条款。

Returns:
如果正在显示用户的位置信息返回true,否则返回false。