Android开发人员不得不收集的代码(持续更新中)

本文原作者Blankj,通过维权骑士授权品牌馆授权转载。

README of English

API

  • Activity相关→ActivityUtils.javaDemo

    isActivityExists   : 判断是否存在Activity
    startActivity      : 打开Activity
    getLauncherActivity: 获取入口activity
    getTopActivity     : 获取栈顶Activity
    
  • App相关→AppUtils.javaDemo

    isInstallApp         : 判断App是否安装
    installApp           : 安装App(支持7.0)
    installAppSilent     : 静默安装App
    uninstallApp         : 卸载App
    uninstallAppSilent   : 静默卸载App
    isAppRoot            : 判断App是否有root权限
    launchApp            : 打开App
    getAppPackageName    : 获取App包名
    getAppDetailsSettings: 获取App具体设置
    getAppName           : 获取App名称
    getAppIcon           : 获取App图标
    getAppPath           : 获取App路径
    getAppVersionName    : 获取App版本号
    getAppVersionCode    : 获取App版本码
    isSystemApp          : 判断App是否是系统应用
    isAppDebug           : 判断App是否是Debug版本
    getAppSignature      : 获取App签名
    getAppSignatureSHA1  : 获取应用签名的的SHA1值
    isAppForeground      : 判断App是否处于前台
    getForegroundApp     : 获取前台应用包名
    getAppInfo           : 获取App信息
    getAppsInfo          : 获取所有已安装App信息
    cleanAppData         : 清除App所有数据
    
  • 栏相关→BarUtils.java

    setTransparentStatusBar: 设置透明状态栏(api大于19方可使用)
    hideStatusBar          : 隐藏状态栏
    getStatusBarHeight     : 获取状态栏高度
    isStatusBarExists      : 判断状态栏是否存在
    getActionBarHeight     : 获取ActionBar高度
    showNotificationBar    : 显示通知栏
    hideNotificationBar    : 隐藏通知栏
    
  • 缓存相关→CacheUtils.javaTest

    getInstance    : 获取缓存实例
    put            : 缓存中写入数据
    getBytes       : 缓存中读取字节数组
    getString      : 缓存中读取String
    getJSONObject  : 缓存中读取JSONObject
    getJSONArray   : 缓存中读取JSONArray
    getBitmap      : 缓存中读取Bitmap
    getDrawable    : 缓存中读取Drawable
    getParcelable  : 缓存中读取Parcelable
    getSerializable: 缓存中读取Serializable
    getCacheSize   : 获取缓存大小
    getCacheCount  : 获取缓存个数
    remove         : 根据键值移除缓存
    clear          : 清除所有缓存
    
  • 清除相关→CleanUtils.javaDemo

    cleanInternalCache   : 清除内部缓存
    cleanInternalFiles   : 清除内部文件
    cleanInternalDbs     : 清除内部数据库
    cleanInternalDbByName: 根据名称清除数据库
    cleanInternalSP      : 清除内部SP
    cleanExternalCache   : 清除外部缓存
    cleanCustomCache     : 清除自定义目录下的文件
    
  • 剪贴板相关→ClipboardUtils.java

    copyText  : 复制文本到剪贴板
    getText   : 获取剪贴板的文本
    copyUri   : 复制uri到剪贴板
    getUri    : 获取剪贴板的uri
    copyIntent: 复制意图到剪贴板
    getIntent : 获取剪贴板的意图
    
  • 关闭相关→CloseUtils.java

    closeIO       : 关闭IO
    closeIOQuietly: 安静关闭IO
    
  • 转换相关→ConvertUtils.javaTest

    bytes2HexString, hexString2Bytes        : byteArr与hexString互转
    chars2Bytes, bytes2Chars                : charArr与byteArr互转
    memorySize2Byte, byte2MemorySize        : 以unit为单位的内存大小与字节数互转
    byte2FitMemorySize                      : 字节数转合适内存大小
    timeSpan2Millis, millis2TimeSpan        : 以unit为单位的时间长度与毫秒时间戳互转
    millis2FitTimeSpan                      : 毫秒时间戳转合适时间长度
    bytes2Bits, bits2Bytes                  : bytes与bits互转
    input2OutputStream, output2InputStream  : inputStream与outputStream互转
    inputStream2Bytes, bytes2InputStream    : inputStream与byteArr互转
    outputStream2Bytes, bytes2OutputStream  : outputStream与byteArr互转
    inputStream2String, string2InputStream  : inputStream与string按编码互转
    outputStream2String, string2OutputStream: outputStream与string按编码互转
    bitmap2Bytes, bytes2Bitmap              : bitmap与byteArr互转
    drawable2Bitmap, bitmap2Drawable        : drawable与bitmap互转
    drawable2Bytes, bytes2Drawable          : drawable与byteArr互转
    view2Bitmap                             : view转Bitmap
    dp2px, px2dp                            : dp与px互转
    sp2px, px2sp                            : sp与px互转
    
  • 崩溃相关→CrashUtils.java

    getInstance: 获取单例
    init       : 初始化
    
  • 设备相关→DeviceUtils.javaDemo

    isDeviceRooted   : 判断设备是否rooted
    getSDKVersion    : 获取设备系统版本号
    getAndroidID     : 获取设备AndroidID
    getMacAddress    : 获取设备MAC地址
    getManufacturer  : 获取设备厂商
    getModel         : 获取设备型号
    shutdown         : 关机
    reboot           : 重启
    reboot2Recovery  : 重启到recovery
    reboot2Bootloader: 重启到bootloader
    
  • 判空相关→EmptyUtils.javaTest

    isEmpty   : 判断对象是否为空
    isNotEmpty: 判断对象是否非空
    
  • 编码解码相关→EncodeUtils.javaTest

    urlEncode          : URL编码
    urlDecode          : URL解码
    base64Encode       : Base64编码
    base64Encode2String: Base64编码
    base64Decode       : Base64解码
    base64UrlSafeEncode: Base64URL安全编码
    htmlEncode         : Html编码
    htmlDecode         : Html解码
    
  • 加密解密相关→EncryptUtils.javaTest

    encryptMD2, encryptMD2ToString                        : MD2加密
    encryptMD5, encryptMD5ToString                        : MD5加密
    encryptMD5File, encryptMD5File2String                 : MD5加密文件
    encryptSHA1, encryptSHA1ToString                      : SHA1加密
    encryptSHA224, encryptSHA224ToString                  : SHA224加密
    encryptSHA256, encryptSHA256ToString                  : SHA256加密
    encryptSHA384, encryptSHA384ToString                  : SHA384加密
    encryptSHA512, encryptSHA512ToString                  : SHA512加密
    encryptHmacMD5, encryptHmacMD5ToString                : HmacMD5加密
    encryptHmacSHA1, encryptHmacSHA1ToString              : HmacSHA1加密
    encryptHmacSHA224, encryptHmacSHA224ToString          : HmacSHA224加密
    encryptHmacSHA256, encryptHmacSHA256ToString          : HmacSHA256加密
    encryptHmacSHA384, encryptHmacSHA384ToString          : HmacSHA384加密
    encryptHmacSHA512, encryptHmacSHA512ToString          : HmacSHA512加密
    encryptDES, encryptDES2HexString, encryptDES2Base64   : DES加密
    decryptDES, decryptHexStringDES, decryptBase64DES     : DES解密
    encrypt3DES, encrypt3DES2HexString, encrypt3DES2Base64: 3DES加密
    decrypt3DES, decryptHexString3DES, decryptBase64_3DES : 3DES解密
    encryptAES, encryptAES2HexString, encryptAES2Base64   : AES加密
    decryptAES, decryptHexStringAES, decryptBase64AES     : AES解密
    
  • 文件相关→FileIOUtils.javaTest

    writeFileFromIS            : 将输入流写入文件
    writeFileFromBytesByStream : 将字节数组写入文件
    writeFileFromBytesByChannel: 将字节数组写入文件
    writeFileFromBytesByMap    : 将字节数组写入文件
    writeFileFromString        : 将字符串写入文件
    readFile2List              : 读取文件到字符串链表中
    readFile2String            : 读取文件到字符串中
    readFile2BytesByStream     : 读取文件到字节数组中
    readFile2BytesByChannel    : 读取文件到字节数组中
    readFile2BytesByMap        : 读取文件到字节数组中
    
  • 文件相关→FileUtils.javaTest

    getFileByPath            : 根据文件路径获取文件
    isFileExists             : 判断文件是否存在
    rename                   : 重命名文件
    isDir                    : 判断是否是目录
    isFile                   : 判断是否是文件
    createOrExistsDir        : 判断目录是否存在,不存在则判断是否创建成功
    createOrExistsFile       : 判断文件是否存在,不存在则判断是否创建成功
    createFileByDeleteOldFile: 判断文件是否存在,存在则在创建之前删除
    copyDir                  : 复制目录
    copyFile                 : 复制文件
    moveDir                  : 移动目录
    moveFile                 : 移动文件
    deleteDir                : 删除目录
    deleteFile               : 删除文件
    listFilesInDir           : 获取目录下所有文件
    listFilesInDir           : 获取目录下所有文件包括子目录
    listFilesInDirWithFilter : 获取目录下所有后缀名为suffix的文件
    listFilesInDirWithFilter : 获取目录下所有后缀名为suffix的文件包括子目录
    listFilesInDirWithFilter : 获取目录下所有符合filter的文件
    listFilesInDirWithFilter : 获取目录下所有符合filter的文件包括子目录
    searchFileInDir          : 获取目录下指定文件名的文件包括子目录
    getFileLastModified      : 获取文件最后修改的毫秒时间戳
    getFileCharsetSimple     : 简单获取文件编码格式
    getFileLines             : 获取文件行数
    getDirSize               : 获取目录大小
    getFileSize              : 获取文件大小
    getDirLength             : 获取目录长度
    getFileLength            : 获取文件长度
    getFileMD5               : 获取文件的MD5校验码
    getFileMD5ToString       : 获取文件的MD5校验码
    getDirName               : 根据全路径获取最长目录
    getFileName              : 根据全路径获取文件名
    getFileNameNoExtension   : 根据全路径获取文件名不带拓展名
    getFileExtension         : 根据全路径获取文件拓展名
    
  • Fragment相关→FragmentUtils.javaDemo

    addFragment              : 新增fragment
    hideAddFragment          : 先隐藏后新增fragment
    addFragments             : 新增多个fragment
    removeFragment           : 移除fragment
    removeToFragment         : 移除到指定fragment
    removeFragments          : 移除同级别fragment
    removeAllFragments       : 移除所有fragment
    replaceFragment          : 替换fragment
    popFragment              : 出栈fragment
    popToFragment            : 出栈到指定fragment
    popFragments             : 出栈同级别fragment
    popAllFragments          : 出栈所有fragment
    popAddFragment           : 先出栈后新增fragment
    hideFragment             : 隐藏fragment
    hideFragments            : 隐藏同级别fragment
    showFragment             : 显示fragment
    hideShowFragment         : 先隐藏后显示fragment
    getLastAddFragment       : 获取同级别最后加入的fragment
    getLastAddFragmentInStack: 获取栈中同级别最后加入的fragment
    getTopShowFragment       : 获取顶层可见fragment
    getTopShowFragmentInStack: 获取栈中顶层可见fragment
    getFragments             : 获取同级别fragment
    getFragmentsInStack      : 获取栈中同级别fragment
    getAllFragments          : 获取所有fragment
    getAllFragmentsInStack   : 获取栈中所有fragment
    getPreFragment           : 获取目标fragment的前一个fragment
    findFragment             : 查找fragment
    dispatchBackPress        : 处理fragment回退键
    setBackgroundColor       : 设置背景色
    setBackgroundResource    : 设置背景资源
    setBackground            : 设置背景
    
  • Handler相关→HandlerUtils.javaDemo

    HandlerHolder: 使用必读
    
  • 图片相关→ImageUtils.javaDemo

    bitmap2Bytes, bytes2Bitmap      : bitmap与byteArr互转
    drawable2Bitmap, bitmap2Drawable: drawable与bitmap互转
    drawable2Bytes, bytes2Drawable  : drawable与byteArr互转
    getBitmap                       : 获取bitmap
    scale                           : 缩放图片
    clip                            : 裁剪图片
    skew                            : 倾斜图片
    rotate                          : 旋转图片
    getRotateDegree                 : 获取图片旋转角度
    toRound                         : 转为圆形图片
    toRoundCorner                   : 转为圆角图片
    fastBlur                        : 快速模糊
    renderScriptBlur                : renderScript模糊图片
    stackBlur                       : stack模糊图片
    addFrame                        : 添加颜色边框
    addReflection                   : 添加倒影
    addTextWatermark                : 添加文字水印
    addImageWatermark               : 添加图片水印
    toAlpha                         : 转为alpha位图
    toGray                          : 转为灰度图片
    save                            : 保存图片
    isImage                         : 根据文件名判断文件是否为图片
    getImageType                    : 获取图片类型
    compressByScale                 : 按缩放压缩
    compressByQuality               : 按质量压缩
    compressBySampleSize            : 按采样大小压缩
    
  • 意图相关→IntentUtils.java

    getInstallAppIntent        : 获取安装App(支持6.0)的意图
    getUninstallAppIntent      : 获取卸载App的意图
    getLaunchAppIntent         : 获取打开App的意图
    getAppDetailsSettingsIntent: 获取App具体设置的意图
    getShareTextIntent         : 获取分享文本的意图
    getShareImageIntent        : 获取分享图片的意图
    getComponentIntent         : 获取其他应用组件的意图
    getShutdownIntent          : 获取关机的意图
    getCaptureIntent           : 获取拍照的意图
    
  • 键盘相关→KeyboardUtils.javaDemo

    hideSoftInput               : 动态隐藏软键盘
    clickBlankArea2HideSoftInput: 点击屏幕空白区域隐藏软键盘
    showSoftInput               : 动态显示软键盘
    toggleSoftInput             : 切换键盘显示与否状态
    
  • 定位相关→LocationUtils.javaDemo

    isGpsEnabled     : 判断Gps是否可用
    isLocationEnabled: 判断定位是否可用
    openGpsSettings  : 打开Gps设置界面
    register         : 注册
    unregister       : 注销
    getAddress       : 根据经纬度获取地理位置
    getCountryName   : 根据经纬度获取所在国家
    getLocality      : 根据经纬度获取所在地
    getStreet        : 根据经纬度获取所在街道
    isBetterLocation : 是否更好的位置
    isSameProvider   : 是否相同的提供者
    
  • 日志相关→LogUtils.javaDemo

    Builder.setLogSwitch     : 设置log总开关
    Builder.setConsoleSwitch : 设置log控制台开关
    Builder.setGlobalTag     : 设置log全局tag
    Builder.setLogHeadSwitch : 设置log头部信息开关
    Builder.setLog2FileSwitch: 设置log文件开关
    Builder.setDir           : 设置log文件存储目录
    Builder.setBorderSwitch  : 设置log边框开关
    Builder.setConsoleFilter : 设置log控制台过滤器
    Builder.setFileFilter    : 设置log文件过滤器
    v                        : Verbose日志
    d                        : Debug日志
    i                        : Info日志
    w                        : Warn日志
    e                        : Error日志
    a                        : Assert日志
    file                     : log到文件
    json                     : log字符串之json
    xml                      : log字符串之xml
    
  • 网络相关→NetworkUtils.javaDemo

    openWirelessSettings  : 打开网络设置界面
    isConnected           : 判断网络是否连接
    isAvailableByPing     : 判断网络是否可用
    getDataEnabled        : 判断移动数据是否打开
    setDataEnabled        : 打开或关闭移动数据
    is4G                  : 判断网络是否是4G
    getWifiEnabled        : 判断wifi是否打开
    setWifiEnabled        : 打开或关闭wifi
    isWifiConnected       : 判断wifi是否连接状态
    isWifiAvailable       : 判断wifi数据是否可用
    getNetworkOperatorName: 获取移动网络运营商名称
    getNetworkType        : 获取当前网络类型
    getIPAddress          : 获取IP地址
    getDomainAddress      : 获取域名ip地址
    
  • 手机相关→PhoneUtils.javaDemo

    isPhone            : 判断设备是否是手机
    getIMEI            : 获取IMEI码
    getIMSI            : 获取IMSI码
    getPhoneType       : 获取移动终端类型
    isSimCardReady     : 判断sim卡是否准备好
    getSimOperatorName : 获取Sim卡运营商名称
    getSimOperatorByMnc: 获取Sim卡运营商名称
    getPhoneStatus     : 获取手机状态信息
    dial               : 跳至拨号界面
    call               : 拨打phoneNumber
    sendSms            : 跳至发送短信界面
    sendSmsSilent      : 发送短信
    getAllContactInfo  : 获取手机联系人
    getContactNum      : 打开手机联系人界面点击联系人后便获取该号码
    getAllSMS          : 获取手机短信并保存到xml中
    
  • 拼音相关→PinyinUtils.javaTest

    ccs2Pinyin           : 汉字转拼音
    ccs2Pinyin           : 汉字转拼音
    getPinyinFirstLetter : 获取第一个汉字首字母
    getPinyinFirstLetters: 获取所有汉字的首字母
    getSurnamePinyin     : 根据名字获取姓氏的拼音
    getSurnameFirstLetter: 根据名字获取姓氏的首字母
    
  • 进程相关→ProcessUtils.javaDemo

    getForegroundProcessName  : 获取前台线程包名
    killAllBackgroundProcesses: 杀死所有的后台服务进程
    killBackgroundProcesses   : 杀死后台服务进程
    
  • 正则相关→RegexUtils.javaTest

    isMobileSimple : 验证手机号(简单)
    isMobileExact  : 验证手机号(精确)
    isTel          : 验证电话号码
    isIDCard15     : 验证身份证号码15位
    isIDCard18     : 验证身份证号码18位
    isEmail        : 验证邮箱
    isURL          : 验证URL
    isZh           : 验证汉字
    isUsername     : 验证用户名
    isDate         : 验证yyyy-MM-dd格式的日期校验,已考虑平闰年
    isIP           : 验证IP地址
    isMatch        : 判断是否匹配正则
    getMatches     : 获取正则匹配的部分
    getSplits      : 获取正则匹配分组
    getReplaceFirst: 替换正则匹配的第一部分
    getReplaceAll  : 替换所有正则匹配的部分
    
  • 屏幕相关→ScreenUtils.java

    getScreenWidth         : 获取屏幕的宽度(单位:px)
    getScreenHeight        : 获取屏幕的高度(单位:px)
    setLandscape           : 设置屏幕为横屏
    setPortrait            : 设置屏幕为竖屏
    isLandscape            : 判断是否横屏
    isPortrait             : 判断是否竖屏
    getScreenRotation      : 获取屏幕旋转角度
    captureWithStatusBar   : 获取当前屏幕截图,包含状态栏
    captureWithoutStatusBar: 获取当前屏幕截图,不包含状态栏
    isScreenLock           : 判断是否锁屏
    
  • SD卡相关→SDCardUtils.javaDemo

    isSDCardEnable: 判断SD卡是否可用
    getSDCardPath : 获取SD卡路径
    getDataPath   : 获取SD卡Data路径
    getFreeSpace  : 计算SD卡的剩余空间
    getSDCardInfo : 获取SD卡信息
    
  • 服务相关→ServiceUtils.java

    getAllRunningService: 获取所有运行的服务
    startService        : 启动服务
    stopService         : 停止服务
    bindService         : 绑定服务
    unbindService       : 解绑服务
    isServiceRunning    : 判断服务是否运行
    
  • Shell相关→ShellUtils.java

    execCmd: 是否是在root下执行命令
    
  • 尺寸相关→SizeUtils.java

    dp2px, px2dp     : dp与px转换
    sp2px, px2sp     : sp与px转换
    applyDimension   : 各种单位转换
    forceGetViewSize : 在onCreate中获取视图的尺寸
    measureView      : 测量视图尺寸
    getMeasuredWidth : 获取测量视图宽度
    getMeasuredHeight: 获取测量视图高度
    
  • Snackbar相关→SnackbarUtils.javaDemo

    showShort     : 显示短时snackbar
    showLong      : 显示长时snackbar
    showIndefinite: 显示自定义时长snackbar
    addView       : 为SnackBar添加布局
    dismiss       : 取消snackbar显示
    
  • SpannableString相关→SpannableStringUtils.javaDemo

    Builder.setFlag           : 设置标识
    Builder.setForegroundColor: 设置前景色
    Builder.setBackgroundColor: 设置背景色
    Builder.setQuoteColor     : 设置引用线的颜色
    Builder.setLeadingMargin  : 设置缩进
    Builder.setMargin         : 设置间距
    Builder.setBullet         : 设置列表标记
    Builder.setFontSize       : 设置字体尺寸
    Builder.setFontProportion : 设置字体比例
    Builder.setFontXProportion: 设置字体横向比例
    Builder.setStrikethrough  : 设置删除线
    Builder.setUnderline      : 设置下划线
    Builder.setSuperscript    : 设置上标
    Builder.setSubscript      : 设置下标
    Builder.setBold           : 设置粗体
    Builder.setItalic         : 设置斜体
    Builder.setBoldItalic     : 设置粗斜体
    Builder.setFontFamily     : 设置字体系列
    Builder.setTypeface       : 设置字体
    Builder.setAlign          : 设置对齐
    Builder.setBitmap         : 设置图片
    Builder.setDrawable       : 设置图片
    Builder.setUri            : 设置图片
    Builder.setResourceId     : 设置图片
    Builder.setClickSpan      : 设置点击事件
    Builder.setUrl            : 设置超链接
    Builder.setBlur           : 设置模糊
    Builder.append            : 追加样式字符串
    Builder.create            : 创建样式字符串
    
  • SP相关→SPUtils.javaTest

    getInstance: 获取SP实例
    put        : SP中写入数据
    getString  : SP中读取String
    getInt     : SP中读取int
    getLong    : SP中读取long
    getFloat   : SP中读取float
    getBoolean : SP中读取boolean
    getAll     : SP中获取所有键值对
    contains   : SP中是否存在该key
    remove     : SP中移除该key
    clear      : SP中清除所有数据
    
  • 字符串相关→StringUtils.javaTest

    isEmpty         : 判断字符串是否为null或长度为0
    isTrimEmpty     : 判断字符串是否为null或全为空格
    isSpace         : 判断字符串是否为null或全为空白字符
    equals          : 判断两字符串是否相等
    equalsIgnoreCase: 判断两字符串忽略大小写是否相等
    null2Length0    : null转为长度为0的字符串
    length          : 返回字符串长度
    upperFirstLetter: 首字母大写
    lowerFirstLetter: 首字母小写
    reverse         : 反转字符串
    toDBC           : 转化为半角字符
    toSBC           : 转化为全角字符
    
  • 线程池相关→ThreadPoolUtils.java

    ThreadPoolUtils       : ThreadPoolUtils构造函数
    execute               : 在未来某个时间执行给定的命令
    execute               : 在未来某个时间执行给定的命令链表
    shutDown              : 待以前提交的任务执行完毕后关闭线程池
    shutDownNow           : 试图停止所有正在执行的活动任务
    isShutDown            : 判断线程池是否已关闭
    isTerminated          : 关闭线程池后判断所有任务是否都已完成
    awaitTermination      : 请求关闭、发生超时或者当前线程中断
    submit                : 提交一个Callable任务用于执行
    submit                : 提交一个Runnable任务用于执行
    invokeAll, invokeAny  : 执行给定的任务
    schedule              : 延迟执行Runnable命令
    schedule              : 延迟执行Callable命令
    scheduleWithFixedRate : 延迟并循环执行命令
    scheduleWithFixedDelay: 延迟并以固定休息时间循环执行命令
    
  • 时间相关→TimeUtils.javaTest

    millis2String           : 将时间戳转为时间字符串
    string2Millis           : 将时间字符串转为时间戳
    string2Date             : 将时间字符串转为Date类型
    date2String             : 将Date类型转为时间字符串
    date2Millis             : 将Date类型转为时间戳
    millis2Date             : 将时间戳转为Date类型
    getTimeSpan             : 获取两个时间差(单位:unit)
    getFitTimeSpan          : 获取合适型两个时间差
    getNowMills             : 获取当前毫秒时间戳
    getNowString            : 获取当前时间字符串
    getNowDate              : 获取当前Date
    getTimeSpanByNow        : 获取与当前时间的差(单位:unit)
    getFitTimeSpanByNow     : 获取合适型与当前时间的差
    getFriendlyTimeSpanByNow: 获取友好型与当前时间的差
    getMillis               : 获取与给定时间等于时间差的时间戳
    getString               : 获取与给定时间等于时间差的时间字符串
    getDate                 : 获取与给定时间等于时间差的Date
    getMillisByNow          : 获取与当前时间等于时间差的时间戳
    getStringByNow          : 获取与当前时间等于时间差的时间字符串
    getDateByNow            : 获取与当前时间等于时间差的Date
    isToday                 : 判断是否今天
    isLeapYear              : 判断是否闰年
    getChineseWeek          : 获取中式星期
    getUSWeek               : 获取美式式星期
    getWeekIndex            : 获取星期索引
    getWeekOfMonth          : 获取月份中的第几周
    getWeekOfYear           : 获取年份中的第几周
    getChineseZodiac        : 获取生肖
    getZodiac               : 获取星座
    
  • 吐司相关→ToastUtils.javaDemo

    setGravity   : 设置吐司位置
    setView      : 设置吐司view
    getView      : 获取吐司view
    showShortSafe: 安全地显示短时吐司
    showLongSafe : 安全地显示长时吐司
    showShort    : 显示短时吐司
    showLong     : 显示长时吐司
    cancel       : 取消吐司显示
    
  • 压缩相关→ZipUtils.javaTest

    zipFiles          : 批量压缩文件
    zipFile           : 压缩文件
    unzipFiles        : 批量解压文件
    unzipFile         : 解压文件
    unzipFileByKeyword: 解压带有关键字的文件
    getFilesPath      : 获取压缩文件中的文件路径链表
    getComments       : 获取压缩文件中的注释链表
    getEntries        : 获取压缩文件中的文件对象
    
  • 更新Log→update_log.md


Download

Gradle:

compile 'com.blankj:utilcode:1.6.3'

How to use

// init it in the function of onCreate in ur Application
Utils.init(context);

Proguard

-keep class com.blankj.utilcode.** { *; }
-keepclassmembers class com.blankj.utilcode.** { *; }
-dontwarn com.blankj.utilcode.**

本文作者:Rance935本文出处:Android开发人员不得不收集的代码(持续更新中)转载请在开头注明作者详细信息和本文出处
欢迎关注我的微信公众号和QQ群,分享Android 开发和互联网内容
Android技术分享:群号534813930
微信号:androidparks
公众号:AndroidParks

评论

  • universalsitesupplies.co.uk回复

    My wife and i were really peaceful when Raymond could finish up his preliminary research via the precious recommendations he was given through the web page. It's not at all simplistic to just choose to be offering tips which usually a number of people might have been selling. And we keep in mind we need you to appreciate for that. The main illustrations you've made, the easy website menu, the friendships your site assist to create - it is many excellent, and it's leading our son and the family know that that subject is fun, and that's extremely serious. Thanks for the whole thing!

  • universalsitesupplies.co.uk回复

    Good day! I could have sworn I've been to this site before but after reading through some of the post I realized it's new to me. Anyways, I'm definitely glad I found it and I'll be bookmarking and checking back often!

  • Samual回复

    The next time I read a blog, I hope that it doesn’t disappoint me as much as this one. I mean, I know it was my choice to read, but I actually thought you would have something interesting to say.

  • Business plan回复

    Thanks for each of your labor on this website. My niece really likes engaging in research and it's easy to see why. Almost all hear all concerning the dynamic ways you deliver good information through your web site and therefore improve response from some others on the content then our own princess is actually discovering a lot. Take advantage of the rest of the year. You're performing a good job.

  • Business ethics回复

    Just wish to say your article is as amazing. The clarity in your post is simply great and i can assume you're an expert on this subject. Well with your permission allow me to grab your RSS feed to keep updated with forthcoming post. Thanks a million and please carry on the enjoyable work.

  • kevin durant shoes回复

    Hi there! I simply want to give a huge thumbs up for the good data you might have here on this post. I can be coming back to your weblog for extra soon.

  • XXX回复

    I know this if off topic but I'm looking into starting my own weblog and was wondering what all is required to get set up? I'm assuming having a blog like yours would cost a pretty penny? I'm not very internet smart so I'm not 100 positive. Any suggestions or advice would be greatly appreciated. Kudos

  • Fake回复

    Wow, fantastic blog layout! How long have you been blogging for? you make blogging look easy. The overall look of your website is fantastic, as well as the content!

  • Viagra回复

    Hi there, can i share your content on my website?

  • adidas ultra boost 3.0回复

    I and also my buddies were taking note of the nice tricks found on your web blog while before long I got a terrible suspicion I never expressed respect to the web blog owner for those strategies. These young boys came as a consequence warmed to read them and now have definitely been using them. Appreciate your genuinely quite thoughtful as well as for going for this form of great things most people are really needing to understand about. My honest regret for not saying thanks to sooner.

  • justbedding.com.au回复

    I really enjoy looking at on this web site, it holds superb articles. "The living is a species of the dead and not a very attractive one." by Friedrich Wilhelm Nietzsche.

  • justbedding.com.au回复

    Great website you have here but I was wondering if you knew of any discussion boards that cover the same topics talked about here? I'd really like to be a part of community where I can get comments from other experienced people that share the same interest. If you have any recommendations, please let me know. Appreciate it!

  • air jordans回复

    It抯 laborious to seek out educated people on this matter, but you sound like you recognize what you抮e talking about! Thanks

  • yeezy shoes回复

    I wish to express some appreciation to this writer for bailing me out of this particular issue. After browsing through the world-wide-web and seeing techniques which were not pleasant, I believed my life was done. Living devoid of the answers to the difficulties you have sorted out all through your article content is a crucial case, and those which could have adversely damaged my entire career if I hadn't come across your web blog. Your own personal expertise and kindness in controlling almost everything was very helpful. I don't know what I would've done if I had not discovered such a subject like this. I am able to at this time look ahead to my future. Thanks very much for the impressive and result oriented guide. I won't be reluctant to refer your web sites to any individual who requires recommendations on this issue.

  • Best Kona Coffee Online回复

    The Best Kona Coffee took 16 centuries to arrive Online. The best Kona coffee online is still brewed as a drink prepared from the Kona roasted cherry.

  • porn movie回复

    certainly like your web-site however you need to check the spelling on several of your posts. Several of them are rife with spelling problems and I find it very bothersome to inform the reality however I’ll definitely come back again.

  • Sito di Truffatori回复

    Thanks for making me to gain new suggestions about pc's. I also hold the belief that certain of the best ways to help keep your notebook in leading condition is with a hard plastic case, or maybe shell, which fits over the top of your computer. These kinds of protective gear are model precise since they are manufactured to fit perfectly above the natural casing. You can buy all of them directly from owner, or via third party sources if they are for your laptop computer, however not all laptop will have a cover on the market. Once again, thanks for your recommendations.

  • porn movies - qualityaluminumboatlifts.com回复

    Thanks for revealing your ideas. I'd personally also like to state that video games have been ever evolving. Better technology and revolutions have served create genuine and interactive games. All these entertainment games were not that sensible when the concept was first of all being tried. Just like other areas of technology, video games also have had to evolve by way of many decades. This is testimony towards the fast progression of video games.

  • burun estetigi回复

    Hello! I'm at work surfing around your blog from my new apple iphone! Just wanted to say I love reading your blog and look forward to all your posts! Carry on the great work!|

  • Legal回复

    Thanks for sharing excellent informations. Your site is very cool. I am impressed by the details that you¡¦ve on this website. It reveals how nicely you perceive this subject. Bookmarked this website page, will come back for extra articles. You, my friend, ROCK! I found simply the information I already searched all over the place and just could not come across. What a great site.

  • Types Of Lawyers回复

    Wonderful website. A lot of helpful info here. I am sending it to some buddies ans also sharing in delicious. And of course, thanks for your effort!

  • Viagra回复

    i’ve visited this blog a few times now and i have to tell you that i find it quite nice actually. continue doing what you’re doing! 😉

  • cipheronic.in回复

    Your method of telling everything in this article is really good, every one be able to without difficulty be aware of it,
    Thanks a lot.

  • Ofelia回复

    This design is spectacular! You most certainly know how to keep a
    reader amused. Between your wit and your videos, I
    was almost moved to start my own blog (well, almost...HaHa!) Excellent job.
    I really enjoyed what you had to say, and more than that,
    how you presented it. Too cool!

  • gambling回复

    Good day! I know this is kind of off topic but I was wondering which blog platform are you using for this site? I'm getting fed up of WordPress because I've had problems with hackers and I'm looking at alternatives for another platform. I would be great if you could point me in the direction of a good platform.|

  • .linengallery回复

    It's not my first time to visit this web page, i am visiting this web page dailly and obtain nice information from here all the time.|

  • yeezy boost 350 v2回复

    I actually wanted to make a small remark to appreciate you for some of the unique steps you are giving out at this site. My extensive internet search has at the end been paid with pleasant facts to share with my two friends. I would mention that many of us site visitors actually are unequivocally endowed to be in a fabulous network with many lovely individuals with great pointers. I feel quite privileged to have come across your web pages and look forward to some more pleasurable moments reading here. Thank you once again for a lot of things.

  • Technology News回复

    What i do not realize is in fact how you're no longer actually much more well-preferred than you may be now. You're so intelligent. You already know therefore significantly with regards to this topic, made me for my part believe it from numerous numerous angles. Its like women and men are not interested unless it is something to do with Girl gaga! Your own stuffs nice. At all times maintain it up!

  • basketball shoes回复

    Can I simply say what a relief to seek out somebody who actually knows what theyre speaking about on the internet. You definitely know the way to bring a difficulty to light and make it important. Extra people need to read this and understand this aspect of the story. I cant consider youre not more in style because you definitely have the gift.

  • adidas ultra boost回复

    Thank you so much for giving everyone an extraordinarily breathtaking chance to read critical reviews from this site. It is often very ideal and as well , full of a great time for me and my office friends to search your web site a minimum of 3 times every week to read the new tips you have got. And indeed, I am always satisfied with all the special information you serve. Certain 4 tips in this posting are basically the simplest we've had.

  • industrial doors回复

    Do you mind if I quote a couple of your posts as long
    as I provide credit and sources back to your weblog?
    My website is in the very same niche as yours and
    my visitors would truly benefit from a lot of the information you present here.

    Please let me know if this okay with you. Cheers!

  • woman fashion回复

    Useful info. Fortunate me I discovered your web site unintentionally, and I'm surprised why this accident did not came about in advance! I bookmarked it.

  • workout routines回复

    You actually make it seem so easy with your presentation but I find this matter to be actually something which I think I would never understand. It seems too complex and extremely broad for me. I am looking forward for your next post, I’ll try to get the hang of it!

  • medical school回复

    Hello there, just became alert to your blog through Google, and found that it's really informative. I am gonna watch out for brussels. I will appreciate if you continue this in future. Many people will be benefited from your writing. Cheers!

  • lesbian toys回复

    we came across a cool web site which you may well appreciate. Take a look if you want

  • Vern回复

    An outstanding share! I have just forwarded this onto
    a coworker who was conducting a little research on this.

    And he in fact ordered me breakfast because I stumbled upon it for
    him... lol. So allow me to reword this....
    Thank YOU for the meal!! But yeah, thanks for
    spending some time to talk about this matter here on your web site.

  • picture mounts回复

    This is really interesting, You are a very skilled blogger.
    I have joined your feed and look forward to seeking more of your excellent post.
    Also, I have shared your site in my social networks!

  • car insurance michigan回复

    Good day I am so thrilled I found your webpage, I really found you by mistake,
    while I was searching on Digg for something else, Anyways I am here now and would just like to say
    thanks for a fantastic post and a all round exciting blog
    (I also love the theme/design), I don’t have time to browse it all at the moment but I have book-marked it and also added your RSS feeds, so
    when I have time I will be back to read much more, Please do keep up the
    excellent b.