2011-12-21 7 views
0

맵의 가까운 곳에 표시 할지도 응용 프로그램을 만들었습니다. 사용자가지도의 핀을 클릭하면 경로를 표시하라는 경고 대화 상자가 나타납니다. 내 문제 핀이 빠르게 연속해서 여러 번 클릭 될 때 메시지 상자가 두 번 이상 나타납니다. 메시지가 한 번 이상 나타나기를 원하지 않습니다. 누구든지 나를 도울 수 있습니까? 내 코드는 다음과 같습니다 핀오버레이 항목의 빠른 연속 탭 처리

protected boolean onTap(int pos) { 

    final ProgressDialog myDialog = ProgressDialog.show(LocationBasedServicesV1.this, "", "Please Wait..."); 
     OverlayItem item = items.get(pos); 
      Thread backgroundThread = new Thread(new Runnable(){ 
     @Override 
     public void run() { 
      runOnUiThread(new Runnable() {      
      @Override 
       public void run() { 
       AlertDialog.Builder dialog = new AlertDialog.Builder( LocationBasedServicesV1.this); 
       dialog.setTitle(listDetailsVO.getName()); 
       dialog.setMessage("Address: "+destination+"\nPhone: "+finalPhone+"\nEmail Id: "+finalEmail+"\nDistance: "+finalDistance+unit); 
       dialog.setPositiveButton("Show Route", new DialogInterface.OnClickListener(){ 
       @Override 
       public void onClick(DialogInterface arg0, int arg1) { 
        try { 
         Intent i = new Intent(LocationBasedServicesV1.this, ShowRouteActivity.class); 
         i.putExtra("destination", destination); 
         i.putExtra("source", currentAddress); 
         startActivity(i); 
         } catch (Exception e) { 
          e.printStackTrace(); 
         } 
        } 
      }); 
      dialog.setNegativeButton("Cancel", new DialogInterface.OnClickListener(){ 
      @Override 
      public void onClick(DialogInterface dialog, int which) { 
      } 
      }); 
     dialog.show(); 
     } 
     }); 
     myDialog.dismiss(); 
     } 
     }); 
     backgroundThread.start(); 
    } 

답변

1

체크 위치가 바로 다음) 다음은 ONTAP (에 같은 위치를 가지고 당신이 동일한 핀에 다시 사용자가 클릭 3 위치 핀 후 5 핀 사용자가 클릭이 방법을 가정 아무것도하지 않고 그렇지 않으면 마지막으로 열려있는 대화 상자를 닫고 새 대화 상자를 만들거나 기존 대화 상자를 사용하여 해당 위치에 표시하십시오.

+0

이 아이디어는 효과가 있습니다 ... 감사합니다. – Nishant

관련 문제