当前位置: 首页 > news >正文

做网站还是小程序/整合营销名词解释

做网站还是小程序,整合营销名词解释,网站建设的细节处理,东莞网站推广定制公司您的位置确实不会保存在数据库中,因为每次更新您的位置时(通过onLocationChanged(位置位置))你应该做的是在你的OnCreate()方法中使用你的timerinitialization.然后声明这些变量.double lat location.getLatitude();double lng location.getLongitude();double alt location…

您的位置确实不会保存在数据库中,因为每次更新您的位置时(通过onLocationChanged(位置位置))

你应该做的是在你的OnCreate()方法中使用你的timerinitialization.然后声明这些变量.

double lat = location.getLatitude();

double lng = location.getLongitude();

double alt = location.getAltitude();

作为全局并在onLocationChanged(位置位置)方法中更新它们.这样,只要计时器调用数据库中的持久性,lat,lng,alt值就会可用并根据您的最新位置进行更新.

//decalred as global variables

String curTime;

double lat;

double lng;

double alt;

public void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.main);

LocationManager locationManager;

String context = Context.LOCATION_SERVICE;

locationManager = (LocationManager)getSystemService(context);

Criteria criteria = new Criteria();

criteria.setAccuracy(Criteria.ACCURACY_FINE);

criteria.setAltitudeRequired(false);

criteria.setBearingRequired(false);

criteria.setCostAllowed(true);

criteria.setPowerRequirement(Criteria.POWER_LOW);

String provider = locationManager.getBestProvider(criteria,true);

//Initialize timer

Timer timer = new Timer();

timer.schedule(new TimerTask(){

@Override

public void run(){

db.execSQL("INSERT INTO location (longitude,latitude,altitude,tgl_buat) VALUES " +

"('"+lng+"','"+lat+"','"+alt+"','"+curTime+"')");

db.close();

}

},10*60*1000,10*60*1000);

updateWithNewLocation(null);

locationManager.requestLocationUpdates(provider,(10*60*1000),10,locationListener);

}

private final LocationListener locationListener = new LocationListener() {

public void onLocationChanged(Location location) {

updateWithNewLocation(location);

}

public void onProviderDisabled(String provider){

updateWithNewLocation(null);

}

public void onProviderEnabled(String provider){ }

public void onStatusChanged(String provider,int status,Bundle extras){ }

};

public void updateWithNewLocation(Location location) {

if (location != null) {

Dbhelper helper = new Dbhelper(this);

final SQLiteDatabase db = helper.getWritableDatabase();

long time = System.currentTimeMillis();

SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd kk:mm:ss");

curTime = df.format(time);

lat = location.getLatitude();

lng = location.getLongitude();

alt = location.getAltitude();

System.out.println(lat);

System.out.println(lng);

System.out.println(alt);

}

}

添加: – 如果您绘制路径,则使用此代码

/** Called when the activity is first created. */

private List mapOverlays;

private Projection projection;

@Override

public void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.main);

linearLayout = (LinearLayout) findViewById(R.id.zoomview);

mapView = (MapView) findViewById(R.id.mapview);

mapView.setBuiltInZoomControls(true);

mapOverlays = mapView.getOverlays();

projection = mapView.getProjection();

mapOverlays.add(new MyOverlay());

}

@Override

protected boolean isRouteDisplayed() {

return false;

}

class MyOverlay extends Overlay{

public MyOverlay(){

}

public void draw(Canvas canvas,MapView mapv,boolean shadow){

super.draw(canvas,mapv,shadow);

Paint mPaint = new Paint();

mPaint.setDither(true);

mPaint.setColor(Color.RED);

mPaint.setStyle(Paint.Style.FILL_AND_STROKE);

mPaint.setStrokeJoin(Paint.Join.ROUND);

mPaint.setStrokeCap(Paint.Cap.ROUND);

mPaint.setStrokeWidth(2);

GeoPoint gP1 = new GeoPoint(19240000,-99120000);

GeoPoint gP2 = new GeoPoint(37423157,-122085008);

Point p1 = new Point();

Point p2 = new Point();

Path path = new Path();

projection.toPixels(gP1,p1);

projection.toPixels(gP2,p2);

path.moveTo(p2.x,p2.y);

path.lineTo(p1.x,p1.y);

canvas.drawPath(path,mPaint);

}

http://www.jmfq.cn/news/5109859.html

相关文章:

  • 香港网站域名是什么结尾/营销平台
  • 企业网站建设的可行性/百度投放平台
  • 不想花钱做网站推广/如何推广一个平台
  • 网站建设阿里云/有哪些免费网站可以发布广告
  • 网站建设要用H5吗/宁德市中医院
  • 公司网站建设注意事项/哪里有专业的培训机构
  • 我想建立一个网站不知道怎么做啊/免费广告推广软件
  • 一级a做爰片阿v祥仔网站/泰安百度公司代理商
  • 我的世界做rpg网站/怎样推广自己的app
  • 连云港网站建设公司/拉新app推广平台
  • 做美女图片网站挣钱么/五年级下册数学优化设计答案
  • 合优网站建设/子域名大全查询
  • 做淘客网站用备案吗/如何注册一个网站
  • 建设网站的具体步骤/友情链接交换群
  • 湖南省城乡与住房建设厅网站/seo优化点击软件
  • 坑梓网站建设咨询/百度官方免费下载
  • 如何做适合手机访问的网站/网络广告人社区官网
  • 哈尔滨制作网站多少钱/常州seo第一人
  • 柳林网站建设/关键词优化快排
  • 赣州网站优化制作/网店推广策划方案
  • 企业建设网站个人总结报告/线上营销培训
  • 湖南长沙网站建设公司电话/企业培训计划
  • 社区网站优化/网络推广平台收费不便宜
  • 行业网站推广怎么做/seo的基本步骤顺序正确的是
  • 哪里有网站可以做动态视频倒计时/高级搜索引擎技巧
  • 找晚上做的工作去哪个网站/现在最火的推广平台
  • 外贸电商做俄罗斯市场网站/电话百度
  • 西南大学校园网站建设往年考试卷/游戏交易平台
  • 苏州网站建设要点/1688关键词排名查询工具
  • 本单位政府网站建设的个性化需求/恶意点击软件哪个好