2

The Gmail app will spawn a Toast when the user has no internet connectivity. I've noticed that this Toast will dismiss if the user touches anywhere but the Toast's content area. I can think of a naive way to emulate this that would add code all over the place. Is there a good way to accomplish this with minimal code changes?

theblang
  • 10,215
  • 9
  • 69
  • 120
  • What's your naive way? Mine would be to cover the whole screen with a transparent view that detects touch events, and then put the toast on top of that... On the other hand, for a standard Dialog, looks like there's a [setCancelledOnTouchOutside](http://stackoverflow.com/questions/8384067/how-to-dismiss-the-dialog-with-click-on-outside-of-the-dialog) (Is this a Toast or a Dialog? A Toast automatically disappears after a while...) – Matt Gibson Sep 16 '14 at 16:45
  • My naive way was to set a bunch of listeners. I actually don't mind your way! How could you place the toast on top? Would it be on top by default since it has a more global context? – theblang Sep 16 '14 at 16:48
  • @MattGibson It is a `Toast`. I know it automatically disappears, but I also want it to disappear if the user touches outside of it. – theblang Sep 16 '14 at 17:01

0 Answers0