In android, the Toast display time is customized. androidtoast
Toast is often used as a reminder for Android. However, sometimes a lot of Toast Pop-up
Make the whole program look less harmonious. The official website only provides two types of display time,
Toast. LENGTH_LONG display time is 3.5 seconds, Toast. LENGTH_SHORT display
The time is 2 seconds. The following code defines the time. For details, see the code.
/*** Define a Toast input time as millisecond ** @ param c * @ param info * @ param time */public static void setToatBytTime (Context c, string info, int time) {final Toast toast = Toast. makeText (c, info, Toast. LENGTH_SHORT); toast. show (); Handler handler = new Handler (); handler. postDelayed (new Runnable () {public void run () {toast. cancel () ;}}, time) ;}</textarea>
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.