gwtevent-listenergwt-activities

Key Listener called again and again if I click on Browser's back Button with Activity and Places in GWT


I am creating search page and I have use activity and places in GWT. I have used Key Listener so when user press Enter it redirect user on result page. Problem is that when user use browser back button and again press enter Key Listener call twice same if user again click back button next time it will call trice and so on. Is there any solution for this?


Solution

  • You're probably adding your listener when activity starts but never remove it (e.g. when activity stops).

    The full solution depends how you code your activity (do you reuse activity instances? do you have a separate view with activity acting as a presenter/controller? if so, is the view a singleton, or at list lives longer than the activity and can be reused by another activity instance? etc.)