Common source of the second: uiutils

Source: Internet
Author: User

 Packagecom.itheima.googleplay_8.utils;ImportAndroid. R.anim;ImportAndroid.content.Context;Importandroid.content.res.Resources;ImportAndroid.os.Handler;ImportCom.itheima.googleplay_8.base. baseapplication;/** * @authorAdministrator * @time 2015-7-15 a.m. 10:59:15 * @des and UI-related tool classes * *@version$Rev: 8 $ * @updateAuthor $Author: ADMIN $ * @updateDate $Date: 2015-07-15 17:06:45 +0800 (Wednesday, 157 months) $ * @upda Tedes TODO*/ Public classUiutils {/**Get Context*/     Public StaticContext GetContext () {returnBaseapplication.getcontext (); }    /**Get Resouce Object*/     Public StaticResources getresource () {returnGetContext (). Getresources (); }    /**get the string in String.xml*/     Public StaticString getString (intresId) {        returngetresource (). getString (ResId); }    /**get an array of strings in String.xml*/     Public StaticString[] Getstringarr (intresId) {        returngetresource (). Getstringarray (ResId); }    /**get the color in Colors.xml*/     Public Static intGetColor (intColorid) {        returngetresource (). GetColor (Colorid); }    /**get the package name of the application*/     Public StaticString Getpackagename () {returnGetContext (). Getpackagename (); }    /**get the main thread ID*/     Public Static LongGetmainthreadid () {returnBaseapplication.getmaintreadid (); }    /**get the main thread handler*/     Public StaticHandler Getmainthreadhandler () {returnBaseapplication.gethandler (); }    /**secure execution of a task*/     Public Static voidposttasksafely (Runnable Task) {intCurthreadid =Android.os.Process.myTid (); if(Curthreadid = = Getmainthreadid ()) {//if the current thread is the main pathTask.run (); } Else{//if the current thread is not the main pathGetmainthreadhandler (). Post (Task); }    }}

Common source of the second: uiutils

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.