简体   繁体   中英

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?

You're probably adding your listener when activity starts but never remove it (eg 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.)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM