package com.googlemap;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.Resources;
import android.database.Cursor;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Point;
import android.graphics.RectF;
import android.graphics.Paint.Style;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.util.Log;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Toast;
import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapController;
import com.google.android.maps.MapView;
import com.google.android.maps.MyLocationOverlay;
import com.google.android.maps.Overlay;
import com.googlemap.R;
public class ShowTrack extends MapActivity {
// 定义菜单需要的常量
private static final int MENU_NEW = Menu.FIRST + 1;
private static final int MENU_CON = MENU_NEW + 1;
private static final int MENU_DEL = MENU_CON + 1;
private static final int MENU_MAIN = MENU_DEL + 1;
private TrackDbAdapter mDbHelper;
private LocateDbAdapter mlcDbHelper;
private static final String TAG = "ShowTrack";
private static MapView mMapView;
private MapController mc;
protected MyLocationOverlay mOverlayController;
private Button mZin;
private Button mZout;
private Button mPanN;
private Button mPanE;
private Button mPanW;
private Button mPanS;
private Button mGps;
private Button mSat;
private Button mTraffic;
private Button mStreetview;
private String mDefCaption = "";
private GeoPoint mDefPoint;
private LocationManager lm;
private LocationListener locationListener;
private int track_id;
private Long rowId;
/** Called when the activity is first created. */
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.show_track);
findViews();
centerOnGPSPosition();
revArgs();
// ///////////////
//mDbHelper = new TrackDbAdapter(this);
//mDbHelper.open();
//mlcDbHelper = Track.getDbHelp();
//new LocateDbAdapter(this);
//mlcDbHelper.open();
paintLocates();
startTrackService();
}
private void startTrackService() {
Intent i = new Intent("com.iceskysl.iTracks.START_TRACK_SERVICE");
i.putExtra(LocateDbAdapter.TRACKID, track_id);
startService(i);
}
private void stopTrackService() {
stopService(new Intent("com.iceskysl.iTracks.START_TRACK_SERVICE"));
}
private void paintLocates() {
mlcDbHelper = new LocateDbAdapter(this);
mlcDbHelper.open();
Cursor mLocatesCursor = mlcDbHelper.getTrackAllLocates(track_id);
startManagingCursor(mLocatesCursor);
Resources resources = getResources();
Overlay overlays = new LocateOverLay(resources
.getDrawable(R.drawable.icon), mLocatesCursor);
mMapView.getOverlays().add(overlays);
mlcDbHelper.close();
}
private void revArgs() {
Log.d(TAG, "revArgs.");
Bundle extras = getIntent().getExtras();
if (extras != null) {
String name = extras.getString(TrackDbAdapter.NAME);
//String desc = extras.getString(TrackDbAdapter.DESC);
rowId = extras.getLong(TrackDbAdapter.KEY_ROWID);
track_id = rowId.intValue();
Log.d(TAG, "rowId=" + rowId);
if (name != null) {
setTitle(name);
}
}
}
protected boolean isRouteDisplayed() {
// TODO Auto-generated method stub
return false;
}
private void findViews() {
Log.d(TAG, "find Views");
// Get the map view from resource file
mMapView = (MapView) findViewById(R.id.mv);
mc = mMapView.getController();
SharedPreferences settings = getSharedPreferences(Setting.SETTING_INFOS, 0);
String setting_gps = settings.getString(Setting.SETTING_MAP, "10");
mc.setZoom(Integer.parseInt(setting_gps));
// Set up the button for "Pan East"
mPanE = (Button) findViewById(R.id.sat);
mPanE.setOnClickListener(new OnClickListener() {
// @Override
public void onClick(View arg0) {
panEast();
}
});
// Set up the button for "Zoom In"
mZin = (Button) findViewById(R.id.zin);
mZin.setOnClickListener(new OnClickListener() {
// @Override
public void onClick(View arg0) {
zoomIn();
}
});
// Set up the button for "Zoom Out"
mZout = (Button) findViewById(R.id.zout);
mZout.setOnClickListener(new OnClickListener() {
// @Override
public void onClick(View arg0) {
zoomOut();
}
});
// Set up the button for "Pan North"
mPanN = (Button) findViewById(R.id.pann);
mPanN.setOnClickListener(new OnClickListener() {
// @Override
public void onClick(View arg0) {
panNorth();
}
});
// Set up the button for "Pan East"
mPanE = (Button) findViewById(R.id.pane);
mPanE.setOnClickListener(new OnClickListener() {
// @Override
public void onClick(View arg0) {
panEast();
}
});
// Set up the button for "Pan West"
mPanW = (Button) findViewById(R.id.panw);
mPanW.setOnClickListener(new OnClickListener() {
// @Override
public void onClick(View arg0) {
panWest();
}
});
// Set up the button for "Pan South"
mPanS = (Button) findViewById(R.id.pans);
mPanS.setOnClickListener(new OnClickListener() {
// @Override
public void onClick(View arg0) {
panSouth();
}
});
// Set up the button for "GPS"
mGps = (Button) findViewById(R.id.gps);
mGps.setOnClickListener(new OnClickListener() {
// @Override
public void onClick(View arg0) {
centerOnGPSPosition();
}
});
// Set up the button for "Satellite toggle"
mSat = (Button) findViewById(R.id.sat);
mSat.setOnClickListener(new OnClickListener() {
// @Override
public void onClick(View arg0) {
toggleSatellite();
}
});
// Set up the button for "Traffic toggle"
mTraffic = (Button) findViewById(R.id.traffic);
mTraffic.setOnClickListener(new OnClickListener() {
// @Override
public void onClick(View arg0) {
toggleTraffic();
}
});
// Set up the button for "Traffic toggle"
mStreetview = (Button) findViewById(R.id.streetview);
mStreetview.setOnClickListener(new OnClickListener() {
// @Override
public void onClick(View arg0) {
toggleStreetView();
}
});
// ---use the LocationManager class to obtain GPS locations---
lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
locationListener = new MyLocationListener();
lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0,
locationListener);
}
public boolean onKeyDown(int keyCode, KeyEvent event) {
Log.d(TAG, "onKeyDown");
if (keyCode == KeyEvent.KEYCODE_DPAD_LEFT) {
panWest();
return true;
} else if (keyCode == KeyEvent.KEYCODE_DPAD_RIGHT) {
panEast();
return true;
} else if (keyCode == KeyEvent.KEYCODE_DPAD_UP) {
panNorth();
return true;
} else if (keyCode == KeyEvent.KEYCODE_DPAD_DOWN) {
panSouth();
return true;
}
return false;
}
public void panWest() {
GeoPoint pt = new GeoPoint(mMapView.getMapCenter().getLatitudeE6(),
mMapView.getMapCenter().getLongitudeE6()
- mMapView.getLongitudeSpan() / 4);
mc.setCenter(pt);
}
public void panEast() {
GeoPoint pt = new GeoPoint(mMapView.getMapCenter().getLatitudeE6(),
mMapView.getMapCenter().getLongitudeE6()
+ mMapView.getLongitudeSpan() / 4);
mc.setCenter(pt);
}
public void panNorth() {
GeoPoint pt = new GeoPoint(mMapView.getMapCenter().getLatitudeE6()
+ mMapView.getLatitudeSpan() / 4, mMapView.getMapCenter()
.getLongitudeE6());
mc.setCenter(pt);
}
public void panS
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
Android开发应用从入门到精通 朱桂英 中国铁道出版社 本书循序渐进地讲解了android技术的基本知识,并通过实例直观地演示了android在各个领域中的具体应用。本书内容新颖、知识全面、讲解详细,全书分为4篇17章,第1—4章是基础知识与环境搭建篇,讲解了android的发展前景和开发环境的搭建过程:第5—10章是核心技术篇,详述了android的各类组件和intent、broadcast、adapter等核心知识;第11—14章是典型应用篇,详细讲解了android在现实常见领域中的典型应用。第15—17章是综合实例篇,在具体讲解时都采取了实例验证的教学方法,每个实例先提出制作思路及包含知识点,在实例最后补充总结知识点并引导读者举一反三。 本书定位于android的初、中级用户,适合作为初学者的教材,也可以作为向此领域发展的程序员的参考书。
资源推荐
资源详情
资源评论
收起资源包目录
Android开发应用从入门到精通光盘 (1140个子文件)
resources.ap_ 10.48MB
resources.ap_ 307KB
resources.ap_ 242KB
resources.ap_ 33KB
resources.ap_ 28KB
resources.ap_ 13KB
resources.ap_ 11KB
resources.ap_ 8KB
resources.ap_ 8KB
resources.ap_ 8KB
resources.ap_ 7KB
resources.ap_ 6KB
resources.ap_ 6KB
resources.ap_ 6KB
resources.ap_ 6KB
resources.ap_ 6KB
resources.ap_ 6KB
resources.ap_ 6KB
resources.ap_ 6KB
resources.ap_ 6KB
resources.ap_ 6KB
resources.ap_ 5KB
resources.ap_ 5KB
resources.ap_ 5KB
MainActivity.apk 10.49MB
Galleryjia.apk 525KB
TabWidget.apk 311KB
widges.apk 247KB
google map.apk 51KB
secretary.apk 46KB
jindu.apk 45KB
toast and notification.apk 19KB
caozuoriji.apk 18KB
ActivityMain.apk 16KB
RijiSQLite.apk 15KB
RSS_163READER.apk 13KB
Activity.apk 13KB
UserService.apk 13KB
ActivityMain.apk 13KB
ListTest.apk 12KB
SimpleAdapter.apk 12KB
Spinner.apk 11KB
UserCurrentLocationMap.apk 11KB
UserListActivity.apk 10KB
ActivityMenu.apk 10KB
GPSCurrentLocation.apk 10KB
SMS.apk 10KB
DiaPhone.apk 10KB
DialPhone.apk 10KB
RelativeLayout.apk 9KB
TableLayout.apk 9KB
vertical.apk 8KB
horizontal.apk 8KB
SimpleAdapterUsage.apk 8KB
UseSharedPreferences.apk 8KB
SimpleCursorAdapterUsage.apk 8KB
UserArrayAdapter.apk 8KB
first.apk 7KB
ShowTrack.class 11KB
FetchData.class 11KB
ToolHelper.class 10KB
UserSQLite.class 9KB
DiaryDbAdapter.class 8KB
DiaryContentProvider.class 8KB
ActivityMain.class 8KB
ActivityDiaryEditor.class 8KB
mixchuli.class 6KB
UserSQLite$DatabaseHelper.class 6KB
DiaryContentProvider$DatabaseHelper.class 6KB
ActivityMain.class 6KB
Setting.class 6KB
Activity01.class 5KB
DiaryDbAdapter$DatabaseHelper.class 5KB
rotate.class 5KB
iTracks.class 5KB
wenjian.class 5KB
UserCurrentLocationMap.class 5KB
Hardware.class 4KB
TrackDbAdapter.class 4KB
ActivityDiaryEdit.class 4KB
Runing.class 4KB
ActivityMain.class 4KB
System.class 4KB
Software.class 4KB
Infos.class 4KB
ActivityMain.class 4KB
MainActivity.class 4KB
ShowInfo.class 4KB
Galleryjia$ImageAdapter.class 4KB
LocateDbAdapter.class 4KB
ActivityMainNotification.class 4KB
ImageShowActivity.class 4KB
LocateOverLay.class 4KB
FileSearch.class 4KB
ActivityToast.class 3KB
Galleryjia.class 3KB
clock.class 3KB
ShowTrack$MyOverlay.class 3KB
ShowTrack$MyLocationListener.class 3KB
clock$LooperThread.class 3KB
共 1140 条
- 1
- 2
- 3
- 4
- 5
- 6
- 12
dog321321
- 粉丝: 34
- 资源: 143
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
- 3
- 4
- 5
- 6
前往页