我正在尝试在android上制作一个应用程序,这只是一个使用智能手机GPS的典型地图,我计划使用Dijkstra的最短路径算法。
我计划做的是制作一个岛屿的俯视图地图,并从我的gps收集岛屿道路上每个十字路口的纬度和经度数据,将图像(我制作的岛屿地图)与纬度和经度数据连接起来,然后执行Dijkstra的最短路径算法。
有什么建议吗?
我该怎么做呢?
发布于 2016-08-02 01:15:22
第一个活动文件
getFragmentManager().findFragmentById(R.id.map)).getMap();= ((MapFragment) GoogleMap googleMap;googleMap =((MapFragment)googleMap
发布于 2016-08-03 14:33:41
本指南是向Android应用程序添加地图的快速入门。Android Studio是使用Google Maps Android API构建应用程序的推荐开发环境。
步骤1.下载Android Studio
步骤2.安装Google Play服务SDK
步骤3.创建Google Maps项目
步骤4.获取Google Maps API密钥
第5步: Hello Map!看一下代码
第6步:连接Android设备
步骤7.构建并运行您的应用程序
启用GPS:
@Override
protected void onStart() {
super.onStart(); // Always call the superclass method first
// The activity is either being restarted or started for the first time
// so this is where we should make sure that GPS is enabled
LocationManager locationManager =
(LocationManager) getSystemService(Context.LOCATION_SERVICE);
boolean gpsEnabled = locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER);
if (!gpsEnabled) {
// Create a dialog here that requests the user to enable GPS, and use an intent
// with the android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS action
// to take the user to the Settings screen to enable GPS when they click "OK"
}
}希望这能有所帮助!
https://stackoverflow.com/questions/38703996
复制相似问题