小编Dav*_*son的帖子

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万
查看次数

如何从listview适配器位置获取对象值

如何从适配器位置获取值,我的代码如下:

CategoriesXmlParser categoryXmlParser = new CategoriesXmlParser();
List<HashMap<String, Object>> categories = null;

try {
  categories = categoryXmlParser.parse(reader);
} catch (Exception e) {
  Log.d("Exception", e.toString());
}

String[] from = { "name", "image" };
int[] to = { R.id.nama_category, R.id.logo_category };

final SimpleAdapter adapter = new SimpleAdapter(getBaseContext(),
                    categories, R.layout.per_item_category, from, to);

mListView.setOnItemClickListener(new OnItemClickListener() {
  public void onItemClick(AdapterView<?> parent, View view,
                        int position, long id) {
    Object obj = mListView.getAdapter().getItem(position);
    String value = obj.toString();
    Log.d("MyLog", "Value is: "+value);
    String name = // how code …
Run Code Online (Sandbox Code Playgroud)

android listview listview-adapter

8
推荐指数
2
解决办法
6万
查看次数

Android:如何将引脚添加到谷歌地图

可能重复:
将地图引脚添加到Google Map Android的最佳方式

如何添加pin和如果点击显示balon与信息地址或城市我有自定义getOverlay()在谷歌地图API android.

在我的代码下面:

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main_map);

    mapView = (MapView) findViewById(R.id.map_view);
    GeoPoint gpStart = new GeoPoint((int) (-6.31689 * 1E6),
            (int) (106.74040 * 1E6));

    GeoPoint gpEnd = new GeoPoint((int) (-6.29729 * 1E6),
            (int) (106.78386 * 1E6));

    Route r = direction(gpStart, gpEnd);
    RouteOverlay rOverlay = new RouteOverlay(r, Color.RED);
    mapView.getOverlays().add(rOverlay);
    mapView.getController().animateTo(gpStart);
    mapView.getController().setZoom(15);
    mapView.setBuiltInZoomControls(true);
}
Run Code Online (Sandbox Code Playgroud)

我的代码已编辑,上面的代码我从这里开始为我工作,但没有在地点显示引脚.如果代码是谷歌地图V1的标准,我知道要放pin.只需添加叠加层.但我的问题是我从json数组获取地图.所以我想在位置(geopoint)添加pin,如果我点击我获取信息地址.

谢谢.

android google-maps

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

如何获得谷歌地图API密钥

如何获取Android的Google地图api密钥,我已经阅读了更多的文章,但没有成功.

我看代码android如下:

<?xml version="1.0" encoding="utf-8"?>
<com.google.android.maps.MapView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/mapview"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:apiKey="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
    android:clickable="true" />
Run Code Online (Sandbox Code Playgroud)

所以我的问题如何从谷歌获得xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx?请一步一步给我,谢谢.

谢谢.

android google-maps

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

Robot.txt允许在域中指定URL

我想只允许主URL(域)http://domain/about和其他URL搜索谷歌不可见.示例我有如下链接:

http://example.com
http://example.com/about
http://example.com/other1
http://example.com/other2
http://example.com/other3
http://example.com/other4
http://example.com/other5
http://example.com/other6
and more URL. 
Run Code Online (Sandbox Code Playgroud)

我的问题是robot.txt的内容,我想只允许http://example.comhttp://example.com/about,我的网站使用wordpress.

谢谢.

robots.txt

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