0

Googleマップに画像を表示したいのですが、Androidでそれを行う方法がわかりません。Panoramio .i がこれまで行ってきたのと同じよう に、私の Android アプリは、緯度、経度を使用して画像をキャプチャし、sqllite データベースに保存します。緯度、経度に従って、これらの画像を Google マップに入力したいと考えています。

4

2 に答える 2

1

まず、このようなマップを取得する必要があります

private GoogleMap mMap;

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

次に、マップにマーカーを追加できるループを作成できます

for (all the items you want to add) {

    mMap.addMarker(new MarkerOptions()
    .position(LatLng(coordinates))
    .icon(BitmapDescriptorFactory.from where you have it));;
}

Google 開発者サイトの情報を確認してください https://developers.google.com/maps/documentation/android/marker?hl=pt-PT

于 2014-03-14T12:32:37.640 に答える
0

次のようなものを使用して、画像をアイコンとしてマーカーを作成できます。

private MarkerOptions createMarker(LatLng position, String title, String snippet, String image_path) {

    // Standard marker icon in case image is not found
    BitmapDescriptor icon = BitmapDescriptorFactory
            .defaultMarker(BitmapDescriptorFactory.HUE_RED);

    if (!image_path.isEmpty()) {
        File iconfile = new File(image_path);
        if (iconfile.exists()) {
            BitmapDescriptor loaded_icon = BitmapDescriptorFactory
                    .fromPath(image_path);
            if (loaded_icon != null) {
                icon = loaded_icon;
            } else {
                Log.e(TAG, "loaded_icon was null");
            }
        } else {
            Log.e(TAG, "iconfile did not exist: "
                    + image_path);
        }
    } else {
        Log.e(TAG, "iconpath was empty: "
                + image_path);
    }

    return new MarkerOptions().position(position)
                    .title(title)
                    .snippet(snippet).icon(icon);
}
于 2014-03-14T12:33:49.643 に答える