2012-04-16 6 views
0

私は近くに警告ダイアログをポップアップ表示する位置リスナを持っています。しかし、私は周りを歩いていると同じ警告ダイアログを何度もポップアップし続けます。ユーザーがアラートダイアログを送信または拒否したときに、アラートダイアログがポップアップして位置リスナを再度有効にすると、位置リスナを無効にする方法はありますか?LocationListener Alert Dialog複数のポップアップ

+0

を、あなたは次にalertdialog

alertDialog.show(); 

コール

locManager.removeUpdates(locListener); //here locManager is your LocationManager object and locListener is your LocationListener 

を示した後、私はあなたが作業しているものを見ることができるようにあなたのコードの一部を投稿する必要があると思います。そうすれば、望ましい効果を得るために変更を提案するほうが簡単になります。 – breadbin

答えて

0

ユーザーが再びこのように場所リスナーの警告ダイアログ・レジスタのいくつかのボタンをクリックした後..

alertDialog.setButton("OK", new DialogInterface.OnClickListener() { 
    public void onClick(DialogInterface dialog, int which) { 

    //here register for location listener again.. 

    locManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, updateInterval, updateDistance, locListener); 

} }); 
+0

完璧、ありがとう! – Kel196

関連する問題