相关疑难解决方法(0)

使用Google Maps Android API v2在两点之间绘制路径

谷歌改变了Android的地图API并引入了API V2.以前的绘图路径代码不适用于API V2.

我已设法绘制API V2的路径.我已经搜索了很多解决方案,但没有找到任何答案.所以我在分享它的答案.

google-maps routes path google-maps-markers google-maps-android-api-2

82
推荐指数
1
解决办法
10万
查看次数

Android:如何绘制路线方向谷歌地图API V2从当前位置到目的地

如何绘制从当前位置到目的地的路线方向(纬度和经度),我的代码如下:

import android.os.Bundle;
import com.actionbarsherlock.app.SherlockActivity;

import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;

public class DetailMapActivity extends SherlockActivity {
    private GoogleMap map;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main_detail_map);

        LatLng TO_DESTINATION = new LatLng(-6.33438, 106.74316);

        map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map))
                .getMap();
        map.setMyLocationEnabled(true);

        map.addMarker(new MarkerOptions().position(TO_DESTINATION).title("Destination Title")
                .snippet("Destination Description"));

        map.moveCamera(CameraUpdateFactory.newLatLngZoom(TO_LOCATION, 40));

        map.animateCamera(CameraUpdateFactory.zoomTo(10), 2000, null);
    }
}
Run Code Online (Sandbox Code Playgroud)

我想通过提供商网络或gps从当前位置绘制,然后通过驾驶到目的地绘制路线.

我正在使用android google apis V2.

谢谢你的帮助.

android android-maps-v2

32
推荐指数
2
解决办法
9万
查看次数

在地图上的多个点之间绘制路线

我是android的新手.我想在多个标记之间绘制路线.我,从服务器获取纬度,经度和日期时间.现在我想显示点之间的路线.我把它们存放在arraylist中.以下是我在异步任务doInBackground()中获得积分的方法.

  newLatt= new ArrayList<String>();
  newLongg= new ArrayList<String>();
  newdatTime= new ArrayList<String>();

  JSONArray arr = new JSONArray(strServerResponse);
  for (int i = 0; i < arr.length(); i++) {
        JSONObject jsonObj1 = arr.getJSONObject(i);
        String status = jsonObj1.optString("status");
        if (status!="false"){
          Pojo pojo = new Pojo();
          String latitude = jsonObj1.optString("Latitude");
          String longitude = jsonObj1.optString("Longitude");
          String date_time = jsonObj1.optString("date_time");
          newLatt.add(latitude);
          newLongg.add(longitude);
          newdatTime.add(date_time);
       }else {
              Handler handler = new Handler(Looper.getMainLooper());
              handler.post(new Runnable() {
              @Override
              public void run() {
                   AlertDialog alertDialog = new AlertDialog.Builder(
                   MapActivity.this).create();
                   alertDialog.setMessage("Locations Not Available");
                   alertDialog.setButton("OK", …
Run Code Online (Sandbox Code Playgroud)

android google-maps directions

7
推荐指数
1
解决办法
8060
查看次数