On Fri, Nov 27, 2009 at 11:53 AM, Greg Donald <gdon...@gmail.com> wrote: > How can I keep Toast from building up a queue of messages? > > I'm working on a board game and I'm sending status messages back to > the user with this wrapper function I created for Toast: > > private void toast( String s ) > { > if( t != null ) > t.cancel(); > > t = Toast.makeText( getApplicationContext(), s, > Toast.LENGTH_SHORT ); > > t.show(); > } > > The problem is I've made the flow of game play so simple I can now > play it so fast Toast messages queue up, even to the point where they > continue to show on the desktop after I quit out of the game. > > t.cancel() doesn't seem to cancel out the previous message, anyone > know what I might be doing wrong?
When I do t.setDuration( 10000 ); Log.i( "l", "duration: " + t.getDuration() ); My log says 10000 but the Toast message appears for 1 second. When I do t.setDuration( 100 ); My log still says 100 but the Toast message again appears for 1 second. t.cancel() appears to do nothing when called. Toast seems broken. Any idea what I might be doing wrong? -- Greg Donald http://destiney.com/ -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en