splitwise / TokenAutoComplete

Gmail style MultiAutoCompleteTextView for Android
Apache License 2.0
1.3k stars 384 forks source link

TokenListener does not work after activity disappears #340

Closed ahmadkabi closed 5 years ago

ahmadkabi commented 6 years ago

Hi, thanks for your awasome library but i have an issue here.

Token listener does not work after user press home button and coming back to the app. this also happen when i put this to fragment, when this fragment is going to backstack and another fragment come in to the screen, and user goes back to the former fragment (containing TokenCompleteTextView that has set TokenListener to it), this TokenListener does not work

any suggestion to resolve this? thanks

mgod commented 6 years ago

The token listener does not get saved/restored during the parceling process, so you'll need to set the token listener every time your activity is restored. Are you sure the TokeListened is not null when you are expecting it to be called? Where in your activity code are you setting the listener?

ahmadkabi commented 6 years ago

Actually I put MyCompleteTextView inside the fragment. and i set this listener inside fragment's onStart() callback.

mgod commented 6 years ago

That seems like it should work fine, unless you are expecting to see the callback called when the tokens are added while restoring the view.