小编Yen*_*eny的帖子

如何延迟代码执行(绘制路径)几秒钟?

这是关于加载的问题.我的应用程序应该等待3秒然后绘制路径.现在,加载消息框在3秒内出现,但应用程序不会等待3秒并立即绘制.我的编码有问题吗?

非常感谢!!

 public void drawpath(){
       // first to do some checking
    if (sourceLat.equals("22.3366467")  && destinationLat.equals("35.68449"))
        ShowMsgDialog("Please enter the starting point and destination");
    else if (sourceLat.equals("22.3366467") )
        ShowMsgDialog("Please enter the starting point by touch");
    else if (destinationLat.equals("35.68449") )
        ShowMsgDialog("Please enter the destination by touch");

    else if (pairs != null ){
        //  go to loading function
        loading();
        // Start to draw the path
        String[] lngLat = pairs[0].split(",");

        GeoPoint startGP = new GeoPoint((int) (Double.parseDouble(lngLat[1]) * 1E6), (int) (Double.parseDouble(lngLat[0]) * 1E6));

         mc = mapView.getController(); …
Run Code Online (Sandbox Code Playgroud)

android handler progressdialog delayed-execution

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