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();
}
このアイデアは働いています...ありがとう – Nishant