私は google map のコードを持っています。つまり、ビューの切り替え、ピンポイント、住所の取得の 3 つを取得します。私の出力の画像を見てください。
これは私のJavaアラートボックスコードです
if(stop - start > 1000){
AlertDialog alert = new AlertDialog.Builder(Map1.this).create();
alert.setTitle("pick an Option");
alert.setMessage("I told to pick an option");
alert.setButton("place a pinpoint", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
OverlayItem overlayItem = new OverlayItem(touchedPoint,"what's up","2nd String");
CustomPinpoint custom = new CustomPinpoint(d, Map1.this);
custom.insertPinpoint(overlayItem);
overlayList.add(custom);
}
});
alert.setButton2("get address", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Geocoder geocoder = new Geocoder(getBaseContext(), Locale.getDefault());
try{
List<Address> address = geocoder.getFromLocation(touchedPoint.getLatitudeE6() / 1E6, touchedPoint.getLongitudeE6() / 1E6, 1);
if(address.size() > 0){
String display = "";
for(int i = 0; i<address.get(0).getMaxAddressLineIndex(); i++){
display +=address.get(0).getAddressLine(i) + "\n";
}
Toast t = Toast.makeText(getBaseContext(), display, Toast.LENGTH_LONG);
t.show();
}
}catch(IOException e){
}
}
});
alert.setButton3("Toggle View", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if(map.isSatellite()){
map.setSatellite(false);
map.setStreetView(true);
}else{
map.setStreetView(false);
map.setSatellite(true);
}
}
});
alert.show();
return true;
}
結果出力
今私が欲しいのは、カスタム画像アイコンを設定するためにアラートボタンをもう1つ追加する必要があることです(電話のSDカードから取得)。そのため、ボタンを押すと、参照ボタンのように直接動作して画像を設定し、最後にその撮影した画像を Google マップに設定します。マップを開くたびに、その画像も表示する必要があります。関連するコードがある場合は投稿してください。