我正在使用AlertDialog.Builder来构建我的对话框,它有一个需要填充的EditText,我想阻止关闭对话框,而不是.在正面按钮的onClickListener中,我可以检查editText是否已填充,但我不知道如何阻止关闭...
builder.setPositiveButton("title", new DialogInterface.OnClickListener(){
@Override
public void onClick(DialogInterface dialog, int which) {
if(...){
//can close
}else{
//prevent closing
}
}
})
Run Code Online (Sandbox Code Playgroud) 我在每个onLocationChange上得到纬度和经度并制作这样的路线:
public void onLocationChanged(Location location) {
PolylineOptions rectLine2;
rectLine2.add(new LatLng(lat, lon));
mGoogleMap.addPolyline(rectLine2);
}
Run Code Online (Sandbox Code Playgroud)
现在我想在一次点击时清除这条路线,并且当我移动时,应该画一条新路线,但在我的情况下,旧路线不清楚.
我做了以下但没有工作:
mGoogleMap.clear();// It clear's the map, but when I again draw the old route again comes.
Run Code Online (Sandbox Code Playgroud)
也
Polyline polyline;
polyline = mGoogleMap.addPolyline(rectLine2);
polyline.reomve()// This also didn't work.
Run Code Online (Sandbox Code Playgroud)
有没有其他解决方案来清除地图?
提前致谢!