小编Mus*_*bal的帖子

在谷歌地图上绘制基于lat lang的路径

我想在谷歌地图上绘制路径.

基本上我在特定时间间隔后跟踪用户位置.当用户到达某个目的地时,我需要画出他到达目的地的路径.

它工作正常,但问题是它显示之字形路径.见下图.

我想要的是:

我想绘制一条正确的路径,然后跟踪我在跟踪期间得到的点.

我试过的

我搜索并找到了这个链接,我们可以通过最多8点来获取方向.这是Google地图的非商业用户允许的最高限额.有没有其他方法来实现这一目标.因为我在地图上画了很多分.

绘制折线的代码

private void drawPath() {
        if (mMap != null)
            mMap.clear();
        int count = 0;
        LatLng prev = null;
        String[] mProjection = {LocTable.COLUMN_ID, LocTable.COLUMN_LONGITUDE, LocTable.COLUMN_LATITUDE};
        String mSelectionClause = LocTable.COLUMN_ID + "> ?";
        String[] mSelectionArgs = {"0"};
        String mSortOrder = LocTable.COLUMN_ID;

        Cursor mCursor = getContentResolver().query(
                LocContentProvider.CONTENT_URI,   // The content URI of the words table
                mProjection,                        // The columns to return for each row
                mSelectionClause,                    // Selection criteria
                mSelectionArgs,                     // Selection criteria
                mSortOrder); 


        if(mCursor …
Run Code Online (Sandbox Code Playgroud)

android google-maps

12
推荐指数
2
解决办法
1451
查看次数

从改造响应中获取JSON数组

我需要从Retrofit解析JSON数组.我需要获得以下密钥:

{
  "rc":0,
  "message":"success",
  "he":[
    {
      "name":"\u05de\u05e4\u05e7\u05d7",
      "type":0
    }
  ]
}
Run Code Online (Sandbox Code Playgroud)

我可以很容易地得到消息,但我无法从响应中得到"他"数组.

这是我的数据模型类

public class GetRoleData implements Serializable {

    @SerializedName("he")

    private ArrayList<Roles> he;

    @SerializedName("message")
    private String message;

    public GetRoleData() {
        this.he = new ArrayList<>();
        this.message = "";
    }

    public ArrayList<Roles> getUserRoles() {
        return he;
    }

    public String getMessage() {
        return message;
    }

    public class Roles {

        public Roles() {
            name = "";
            type = -1;
        }

        @SerializedName("name")

        private String name;
        @SerializedName("type")

        private int type;

        public int getType() {
            return type; …
Run Code Online (Sandbox Code Playgroud)

arrays android retrofit

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

使用标题和Parametes Volley删除请求

嗨我想使用标题和身体参数使用Volley向服务器发送删除请求.但我无法成功发送请求

我试过的

JSONObject jsonbObjj = new JSONObject();
try {
    jsonbObjj.put("nombre", Integer.parseInt(no_of_addition
            .getText().toString()));
    jsonbObjj.put("cru", crue);
    jsonbObjj.put("annee", 2010);
} catch (JSONException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
}
VolleyRequest mVolleyRequest = new VolleyRequest(
        Method.DELETE, url, jsonbObjj,

        new Listener<JSONObject>() {

            @Override
            public void onResponse(JSONObject jsonObject) {
                // TODO Auto-generated method stub

                if (pDialog != null) {
                    pDialog.dismiss();
                }
                Log.e("Server Response", "response = "
                        + jsonObject.toString());
            }

        }, new ErrorListener() {

            @Override
            public void onErrorResponse(VolleyError arg0) {
                // TODO Auto-generated method stub …
Run Code Online (Sandbox Code Playgroud)

android sql-delete android-volley jsonobject

5
推荐指数
1
解决办法
7367
查看次数