小编Md.*_*moy的帖子

如何防止AlertDialog关闭?

我正在使用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)

android android-alertdialog onclicklistener

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

如何使用PolylineOptions从谷歌地图android v2清除路线并再次绘制一个新的?

我在每个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)

有没有其他解决方案来清除地图?

提前致谢!

android routes map

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