資源簡介
基于騰訊的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.xm
?????目錄???????????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.xm
?????文件???????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個文件信息
評論
共有 條評論