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

StackOverflow https://stackoverflow.com/questions/16371500

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?

有帮助吗?

解决方案

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.)

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top