これが読み込みの問題です。アプリケーションは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();
geoPoint = startGP;
mc.setCenter(geoPoint);
mc.setZoom(15);
mapView.getOverlays().add(new DirectionPathOverlay(startGP, startGP));
......
}
Loading()関数内:
private void loading() {
progressDialog = ProgressDialog.show(this, "Showing Data..", "please wait", true, false);
new Thread()
{
public void run()
{
try{
sleep(3000);
}
catch (Exception e){
e.printStackTrace();
}
finally{
progressDialog.dismiss();
}
}
}.start();
}