• 大小: 1.23MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-08-29
  • 语言: Java
  • 标签: 手机定位  

资源简介

基于腾讯的android定位实例demo

资源截图

代码片段和文件信息

package com.back.activity;

import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.view.View.onclickListener;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

import com.back.bean.Weather;
import com.back.runable.WeatherRunnable;
import com.tencent.map.geolocation.TencentLocation;
import com.tencent.map.geolocation.TencentLocationListener;
import com.tencent.map.geolocation.TencentLocationManager;
import com.tencent.map.geolocation.TencentLocationRequest;

public class Gongju extends Activity implements TencentLocationListener {

private TextView txtlocation txtlowtemp txthightemp txtendtime txttian
txtdinwei;
private ImageView tianimage;
private Button btntieshi btnhuanbao btnliuyan btndingwei;
Thread thread threadlocation;

private String dingweiIfo;
private TencentLocationManager locationManager;
private TencentLocationRequest request;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_gongju);
txtlocation = (TextView) findViewById(R.id.txtlocation);
txtlowtemp = (TextView) findViewById(R.id.txtlowtemp);
txthightemp = (TextView) findViewById(R.id.txthightemp);
txtendtime = (TextView) findViewById(R.id.txtendtime);
txttian = (TextView) findViewById(R.id.Txttian);

txtdinwei = (TextView) findViewById(R.id.locationIfo);
btndingwei = (Button) findViewById(R.id.btn_location);

btntieshi = (Button) findViewById(R.id.frametieshi);
btnhuanbao = (Button) findViewById(R.id.framehuanbao);
btnliuyan = (Button) findViewById(R.id.frameliuyan);
// 显示进度条
// ProgressDialogUtils.showProgressDialog(this “数据加载中...“);

WeatherRunnable runnable = new WeatherRunnable();
thread = new Thread(runnable.getweatherIfo(handler));
thread.start();
// 定位
locationManager = TencentLocationManager.getInstance(this);
// 设置 wgs84 坐标系
locationManager
.setCoordinateType(TencentLocationManager.COORDINATE_TYPE_GCJ02);
request = TencentLocationRequest.create();
request.setInterval(3000);
request.setRequestLevel(TencentLocationRequest.REQUEST_LEVEL_ADMIN_AREA);
int error = locationManager.requestLocationUpdates(request this);
if (error == 0) {
System.out.println(“注册成功“);
}
btndingwei.setonclickListener(new LocationListener());

}

Handler handler = new Handler() {
public void handleMessage(android.os.Message msg) {
Weather weather = (Weather) msg.obj;
txtlocation.setText(weather.getCity());
txtendtime.setText(“最后更新“ + weather.getPtime());
txtlowtemp.setText(“最低气温“ + weather.getTemp1());
txthightemp.setText(“最高气温“ + weather.getTemp2());
txttian.setText(weather.getWeather());
// 天气图片占时未填加

// 进度条取消
// ProgressDialogUtils.dismissProgressDialog();

};
};

class LocationListener implements onclick

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2014-10-16 10:10  TencentLocationSDK_v4.0_r139747\
     目录           0  2014-10-16 10:11  TencentLocationSDK_v4.0_r139747\demo\
     文件         684  2014-09-18 10:17  TencentLocationSDK_v4.0_r139747\demo\.classpath
     文件         855  2014-08-28 14:20  TencentLocationSDK_v4.0_r139747\demo\.project
     目录           0  2014-10-16 10:10  TencentLocationSDK_v4.0_r139747\demo\.settings\
     文件          57  2014-08-28 14:25  TencentLocationSDK_v4.0_r139747\demo\.settings\org.eclipse.core.resources.prefs
     文件        4722  2014-09-18 11:15  TencentLocationSDK_v4.0_r139747\demo\AndroidManifest.xml
     目录           0  2014-10-16 10:10  TencentLocationSDK_v4.0_r139747\demo\assets\
     文件         797  2014-09-18 12:03  TencentLocationSDK_v4.0_r139747\demo\assets\demos.json
     文件        4020  2014-08-29 16:31  TencentLocationSDK_v4.0_r139747\demo\build.xml
     文件       13455  2014-08-28 14:20  TencentLocationSDK_v4.0_r139747\demo\ic_launcher-web.png
     目录           0  2014-10-16 10:10  TencentLocationSDK_v4.0_r139747\demo\libs\
     文件      621451  2014-08-28 14:20  TencentLocationSDK_v4.0_r139747\demo\libs\android-support-v4.jar
     目录           0  2014-10-16 10:10  TencentLocationSDK_v4.0_r139747\demo\libs\armeabi\
     文件       23780  2014-09-18 10:13  TencentLocationSDK_v4.0_r139747\demo\libs\armeabi\libtencentloc.so
     文件       33949  2014-09-16 11:27  TencentLocationSDK_v4.0_r139747\demo\libs\my_commons.jar
     文件      174641  2014-10-16 09:33  TencentLocationSDK_v4.0_r139747\demo\libs\TencentLocationSDK_v4.0_r139747.jar
     文件      230229  2014-05-15 11:28  TencentLocationSDK_v4.0_r139747\demo\libs\TencentMapSDK_Raster_v1.0.6.jar
     文件         434  2014-08-29 16:31  TencentLocationSDK_v4.0_r139747\demo\local.properties
     文件         801  2014-08-29 16:31  TencentLocationSDK_v4.0_r139747\demo\proguard-project.txt
     文件         563  2014-08-29 16:31  TencentLocationSDK_v4.0_r139747\demo\project.properties
     目录           0  2014-10-16 10:10  TencentLocationSDK_v4.0_r139747\demo\res\
     目录           0  2014-10-16 10:10  TencentLocationSDK_v4.0_r139747\demo\res\drawable-hdpi\
     文件        1103  2014-08-28 14:20  TencentLocationSDK_v4.0_r139747\demo\res\drawable-hdpi\ic_launcher.png
     文件        3184  2014-04-01 20:08  TencentLocationSDK_v4.0_r139747\demo\res\drawable-hdpi\mark_location.png
     文件         729  2014-08-19 09:56  TencentLocationSDK_v4.0_r139747\demo\res\drawable-hdpi\sendtocar_balloon.png
     目录           0  2014-08-28 14:20  TencentLocationSDK_v4.0_r139747\demo\res\drawable-ldpi\
     目录           0  2014-10-16 10:10  TencentLocationSDK_v4.0_r139747\demo\res\drawable-mdpi\
     文件         750  2014-08-28 14:20  TencentLocationSDK_v4.0_r139747\demo\res\drawable-mdpi\ic_launcher.png
     目录           0  2014-10-16 10:10  TencentLocationSDK_v4.0_r139747\demo\res\drawable-xhdpi\
     文件        1479  2014-08-28 14:20  TencentLocationSDK_v4.0_r139747\demo\res\drawable-xhdpi\ic_launcher.png
............此处省略96个文件信息

评论

共有 条评论

相关资源