Finish activity after toast message disappears?

前端 未结 12 1123

Does anybody know, if there is a possibility to do something (in my case finish activity) on toast message will be closed?

12条回答
  •  被撕碎了的回忆
    2020-12-01 10:56

    Actually there are no callbacks when a Toast is being finished, but if you need to know, when will it be closed, you can start a background thread that will sleep a number of milliseconds equal to the Toast duration, and then execute the needed operation. This is just one way of solving the issue, I'm sure there are more solutions. Hope this helps.

提交回复
热议问题