我有谷歌地图的代码,因为我得到三个切换视图,针点和获取地址。看到我输出的图像。
这是我的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;
}
结果输出
现在我想要的是,我必须再添加一个警报按钮来设置自定义图像图标(取自我们的手机SD卡)。当我们按下按钮时,直接表现得像浏览按钮来设置图像,最后在谷歌地图上设置拍摄的图像。当我们打开地图时,图像也需要显示。如果您有相关代码,请发布。