Android Development Tools Class 10_toast Unified management class

Source: Internet
Author: User

Toast Unified Management Class:

1, short time display toast;

2, long time display Toast;

3. Custom display Toast time.

1 ImportAndroid.content.Context;2 ImportAndroid.widget.Toast;3 4  //Toast Unified Management Class5  Public classT6 {7 8     PrivateT ()9     {Ten         /*cannot be instantiated*/ One         Throw NewUnsupportedoperationexception ("cannot be instantiated"); A     } -  -      Public Static BooleanIsshow =true; the  -     /** - * Short time display Toast -      *  +      * @paramContext -      * @parammessage +      */ A      Public Static voidShowshort (Context context, charsequence message) at     { -         if(isshow) - Toast.maketext (context, message, Toast.length_short). Show (); -     } -  -     /** in * Short time display Toast -      *  to      * @paramContext +      * @parammessage -      */ the      Public Static voidShowshort (Context context,intmessage) *     { $         if(isshow)Panax Notoginseng Toast.maketext (context, message, Toast.length_short). Show (); -     } the  +     /** A * Long time display Toast the      *  +      * @paramContext -      * @parammessage $      */ $      Public Static voidShowlong (Context context, charsequence message) -     { -         if(isshow) the Toast.maketext (context, message, Toast.length_long). Show (); -     }Wuyi  the     /** - * Long time display Toast Wu      *  -      * @paramContext About      * @parammessage $      */ -      Public Static voidShowlong (Context context,intmessage) -     { -         if(isshow) A Toast.maketext (context, message, Toast.length_long). Show (); +     } the  -     /** $ * Custom Display Toast time the      *  the      * @paramContext the      * @parammessage the      * @paramDuration -      */ in      Public Static voidShow (context context, charsequence message,intduration) the     { the         if(isshow) About Toast.maketext (context, message, duration). Show (); the     } the  the     /** + * Custom Display Toast time -      *  the      * @paramContextBayi      * @parammessage the      * @paramDuration the      */ -      Public Static voidShow (Context context,intMessageintduration) -     { the         if(isshow) the Toast.maketext (context, message, duration). Show (); the     } the  -}

Android Development Tools Class 10_toast Unified management class

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.