Gradle:
// if u use AndroidX, use the following
implementation 'com.blankj:utilcodex:1.31.1'
// Not in maintenance
implementation 'com.blankj:utilcode:1.30.7'
-
About Activity -> ActivityUtils.java -> Demo
addActivityLifecycleCallbacks
removeActivityLifecycleCallbacks
getAliveActivityByContext
getActivityByContext
isActivityExists
startActivity
startActivityForResult
startActivities
startHomeActivity
getActivityList
getLauncherActivity
getMainActivities
getTopActivity
isActivityAlive
isActivityExistsInStack
finishActivity
finishToActivity
finishOtherActivities
finishAllActivities
finishAllActivitiesExceptNewest
-
About AdaptScreen -> AdaptScreenUtils.java -> Demo
adaptWidth
adaptHeight
closeAdapt
pt2Px
px2Pt
-
About Api -> ApiUtils.java -> README
getApi
-
About App -> AppUtils.java -> Demo
registerAppStatusChangedListener
unregisterAppStatusChangedListener
installApp
uninstallApp
isAppInstalled
isAppRoot
isAppDebug
isAppSystem
isAppForeground
isAppRunning
launchApp
relaunchApp
launchAppDetailsSettings
exitApp
getAppIcon
getAppPackageName
getAppName
getAppPath
getAppVersionName
getAppVersionCode
getAppMinSdkVersion
getAppTargetSdkVersion
getAppSignatures
getAppSignaturesSHA1
getAppSignaturesSHA256
getAppSignaturesMD5
getAppInfo
getAppsInfo
getApkInfo
-
About Array -> ArrayUtils.java -> Test
newArray
newLongArray
newIntArray
newShortArray
newCharArray
newByteArray
newDoubleArray
newFloatArray
newBooleanArray
isEmpty
getLength
isSameLength
get
set
equals
reverse
copy
subArray
add
remove
removeElement
indexOf
lastIndexOf
contains
toPrimitive
toObject
asList
asUnmodifiableList
asArrayList
asLinkedList
sort
forAllDo
toString
-
About Bar -> BarUtils.java -> Demo
getStatusBarHeight
setStatusBarVisibility
isStatusBarVisible
setStatusBarLightMode
isStatusBarLightMode
addMarginTopEqualStatusBarHeight
subtractMarginTopEqualStatusBarHeight
setStatusBarColor
setStatusBarColor4Drawer
transparentStatusBar
getActionBarHeight
setNotificationBarVisibility
getNavBarHeight
setNavBarVisibility
isNavBarVisible
setNavBarColor
getNavBarColor
isSupportNavBar
setNavBarLightMode
isNavBarLightMode
transparentNavBar
-
About Brightness -> BrightnessUtils.java -> Demo
isAutoBrightnessEnabled
setAutoBrightnessEnabled
getBrightness
setBrightness
setWindowBrightness
getWindowBrightness
-
About Bus -> BusUtils.java -> README
register
unregister
post
postSticky
removeSticky
toString_
-
About CacheDiskStatic -> CacheDiskStaticUtils.java -> Test
setDefaultCacheDiskUtils
put
getBytes
getString
getJSONObject
getJSONArray
getBitmap
getDrawable
getParcelable
getSerializable
getCacheSize
getCacheCount
remove
clear
-
About CacheDisk -> CacheDiskUtils.java -> Test
getInstance
Instance.put
Instance.getBytes
Instance.getString
Instance.getJSONObject
Instance.getJSONArray
Instance.getBitmap
Instance.getDrawable
Instance.getParcelable
Instance.getSerializable
Instance.getCacheSize
Instance.getCacheCount
Instance.remove
Instance.clear
-
About CacheDoubleStatic -> CacheDoubleStaticUtils.java -> Test
setDefaultCacheDoubleUtils
put
getBytes
getString
getJSONObject
getJSONArray
getBitmap
getDrawable
getParcelable
getSerializable
getCacheDiskSize
getCacheDiskCount
getCacheMemoryCount
remove
clear
-
About CacheDouble -> CacheDoubleUtils.java -> Test
getInstance
Instance.put
Instance.getBytes
Instance.getString
Instance.getJSONObject
Instance.getJSONArray
Instance.getBitmap
Instance.getDrawable
Instance.getParcelable
Instance.getSerializable
Instance.getCacheDiskSize
Instance.getCacheDiskCount
Instance.getCacheMemoryCount
Instance.remove
Instance.clear
-
About CacheMemoryStatic -> CacheMemoryStaticUtils.java -> Test
setDefaultCacheMemoryUtils
put
get
getCacheCount
remove
clear
-
About CacheMemory -> CacheMemoryUtils.java -> Test
getInstance
Instance.put
Instance.get
Instance.getCacheCount
Instance.remove
Instance.clear
-
About Clean -> CleanUtils.java -> Demo
cleanInternalCache
cleanInternalFiles
cleanInternalDbs
cleanInternalDbByName
cleanInternalSp
cleanExternalCache
cleanCustomDir
-
About Click -> ClickUtils.java -> Demo
applyPressedViewScale
applyPressedViewAlpha
applyPressedBgAlpha
applyPressedBgDark
applySingleDebouncing
applyGlobalDebouncing
expandClickArea
back2HomeFriendly
ClickUtils#OnDebouncingClickListener
ClickUtils#OnMultiClickListener
-
About Clipboard -> ClipboardUtils.java -> Demo
copyText
getText
copyUri
getUri
copyIntent
getIntent
addChangedListener
removeChangedListener
-
About Clone -> CloneUtils.java -> Test
deepClone
-
About Close -> CloseUtils.java
closeIO
closeIOQuietly
-
About Collection -> CollectionUtils.java -> Test
newUnmodifiableList[NotNull]: 新建只读[非空]链表
newArrayList[NotNull] : 新建数组型[非空]链表
newLinkedList[NotNull] : 新建指针型[非空]链表
newHashSet[NotNull] : 新建哈希[非空]集合
newTreeSet[NotNull] : 新建有序[非空]集合
newSynchronizedCollection
newUnmodifiableCollection
union
intersection
disjunction
subtract
containsAny
getCardinalityMap
isSubCollection
isProperSubCollection
isEqualCollection
cardinality
find
forAllDo
filter
select
selectRejected
transform
collect
countMatches
exists
addIgnoreNull
addAll
get
size
sizeIsEmpty
isEmpty
isNotEmpty
retainAll
removeAll
toString
-
About Color -> ColorUtils.java
getColor
setAlphaComponent
setRedComponent
setGreenComponent
setBlueComponent
string2Int
int2RgbString
int2ArgbString
getRandomColor
isLightColor
-
About Convert -> ConvertUtils.java -> Test
int2HexString, hexString2Int
bytes2Bits, bits2Bytes
bytes2Chars, chars2Bytes
bytes2HexString, hexString2Bytes
bytes2String, string2Bytes
bytes2JSONObject, jsonObject2Bytes
bytes2JSONArray, jsonArray2Bytes
bytes2Parcelable, parcelable2Bytes
bytes2Object, serializable2Bytes
bytes2Bitmap, bitmap2Bytes
memorySize2Byte, byte2MemorySize
byte2FitMemorySize
timeSpan2Millis, millis2TimeSpan
millis2FitTimeSpan
input2OutputStream, output2InputStream
inputStream2Bytes, bytes2InputStream
outputStream2Bytes, bytes2OutputStream
inputStream2String, string2InputStream
outputStream2String, string2OutputStream
inputStream2Lines
drawable2Bitmap, bitmap2Drawable
drawable2Bytes, bytes2Drawable
view2Bitmap
dp2px, px2dp
sp2px, px2sp
-
About Crash -> CrashUtils.java
init
CrashInfo.addExtraHead
CrashInfo.getThrowable
CrashInfo.toString
-
About Debouncing -> DebouncingUtils.java
isValid
-
About Device -> DeviceUtils.java -> Demo
isDeviceRooted
isAdbEnabled
getSDKVersionName
getSDKVersionCode
getAndroidID
getMacAddress
getManufacturer
getModel
getABIs
isTablet
isEmulator
isDevelopmentSettingsEnabled
getUniqueDeviceId
isSameDevice
-
About Flashlight -> FlashlightUtils.java -> Demo
isFlashlightEnable
isFlashlightOn
setFlashlightStatus
destroy
-
About Encode -> EncodeUtils.java -> Test
urlEncode
urlDecode
base64Encode
base64Encode2String
base64Decode
htmlEncode
htmlDecode
binaryEncode
binaryDecode
-
About Encrypt -> EncryptUtils.java -> Test
encryptMD2, encryptMD2ToString
encryptMD5, encryptMD5ToString
encryptMD5File, encryptMD5File2String
encryptSHA1, encryptSHA1ToString
encryptSHA224, encryptSHA224ToString
encryptSHA256, encryptSHA256ToString
encryptSHA384, encryptSHA384ToString
encryptSHA512, encryptSHA512ToString
encryptHmacMD5, encryptHmacMD5ToString
encryptHmacSHA1, encryptHmacSHA1ToString
encryptHmacSHA224, encryptHmacSHA224ToString
encryptHmacSHA256, encryptHmacSHA256ToString
encryptHmacSHA384, encryptHmacSHA384ToString
encryptHmacSHA512, encryptHmacSHA512ToString
encryptDES, encryptDES2HexString, encryptDES2Base64
decryptDES, decryptHexStringDES, decryptBase64DES
encrypt3DES, encrypt3DES2HexString, encrypt3DES2Base64
decrypt3DES, decryptHexString3DES, decryptBase64_3DES
encryptAES, encryptAES2HexString, encryptAES2Base64
decryptAES, decryptHexStringAES, decryptBase64AES
encryptRSA, encryptRSA2HexString, encryptRSA2Base64
decryptRSA, decryptHexStringRSA, decryptBase64RSA
rc4
-
About FileIO -> FileIOUtils.java -> Test
writeFileFromIS
writeFileFromBytesByStream
writeFileFromBytesByChannel
writeFileFromBytesByMap
writeFileFromString
readFile2List
readFile2String
readFile2BytesByStream
readFile2BytesByChannel
readFile2BytesByMap
setBufferSize
-
About File -> FileUtils.java -> Test
getFileByPath
isFileExists
rename
isDir
isFile
createOrExistsDir
createOrExistsFile
createFileByDeleteOldFile
copy
move
delete
deleteAllInDir
deleteFilesInDir
deleteFilesInDirWithFilter
listFilesInDir
listFilesInDirWithFilter
getFileLastModified
getFileCharsetSimple
getFileLines
getSize
getLength
getFileMD5
getFileMD5ToString
getDirName
getFileName
getFileNameNoExtension
getFileExtension
notifySystemToScan
getFsTotalSize
getFsAvailableSize
-
About Fragment -> FragmentUtils.java -> Demo
add
show
hide
showHide
replace
pop
popTo
popAll
remove
removeTo
removeAll
getTop
getTopInStack
getTopShow
getTopShowInStack
getFragments
getFragmentsInStack
getAllFragments
getAllFragmentsInStack
findFragment
dispatchBackPress
setBackgroundColor
setBackgroundResource
setBackground
-
About Gson -> GsonUtils.java -> Test
setGsonDelegate
setGson
getGson
toJson
fromJson
getListType
getSetType
getMapType
getArrayType
getType
-
About Image -> ImageUtils.java -> Demo
bitmap2Bytes, bytes2Bitmap
drawable2Bitmap, bitmap2Drawable
drawable2Bytes, bytes2Drawable
view2Bitmap
getBitmap
scale
clip
skew
rotate
getRotateDegree
toRound
toRoundCorner
addCornerBorder
addCircleBorder
addReflection
addTextWatermark
addImageWatermark
toAlpha
toGray
fastBlur
renderScriptBlur
stackBlur
save
save2Album
isImage
getImageType
compressByScale
compressByQuality
compressBySampleSize
getSize
-
About Intent -> IntentUtils.java
isIntentAvailable
getInstallAppIntent
getUninstallAppIntent
getLaunchAppIntent
getLaunchAppDetailsSettingsIntent
getShareTextIntent
getShareImageIntent
getShareTextImageIntent
getComponentIntent
getShutdownIntent
getCaptureIntent
-
About Keyboard -> KeyboardUtils.java -> Demo
showSoftInput
hideSoftInput
toggleSoftInput
isSoftInputVisible
registerSoftInputChangedListener
unregisterSoftInputChangedListener
fixAndroidBug5497
fixSoftInputLeaks
clickBlankArea2HideSoftInput
-
About Language -> LanguageUtils.java -> Demo
applySystemLanguage
applyLanguage
isAppliedLanguage
getAppliedLanguage
getContextLanguage
getAppContextLanguage
getSystemLanguage
updateAppContextLanguage
attachBaseContext
-
About Log -> LogUtils.java -> Demo
getConfig
Config.setLogSwitch
Config.setConsoleSwitch
Config.setGlobalTag
Config.setLogHeadSwitch
Config.setLog2FileSwitch
Config.setDir
Config.setFilePrefix
Config.setBorderSwitch
Config.setSingleTagSwitch
Config.setConsoleFilter
Config.setFileFilter
Config.setStackDeep
Config.setStackOffset
Config.setSaveDays
Config.addFormatter
Config.setFileWriter
Config.setOnConsoleOutputListener
Config.setOnFileOutputListener
Config.addFileExtraHead
log
v
vTag
d
dTag
i
iTag
w
wTag
e
eTag
a
aTag
file
json
xml
getCurrentLogFilePath
getLogFiles
-
About Map -> MapUtils.java -> Test
newUnmodifiableMap
newHashMap
newLinkedHashMap
newTreeMap
newHashTable
isEmpty
isNotEmpty
size
forAllDo
transform
toString
-
About MetaData -> MetaDataUtils.java -> Demo
getMetaDataInApp
getMetaDataInActivity
getMetaDataInService
getMetaDataInReceiver
-
About Network -> NetworkUtils.java -> Demo
openWirelessSettings
isConnected
isAvailable[Async] : 判断网络是否可用
isAvailableByPing[Async] : 用 ping 判断网络是否可用
isAvailableByDns[Async] : 用 DNS 判断网络是否可用
getMobileDataEnabled
isMobileData
is4G
getWifiEnabled
setWifiEnabled
isWifiConnected
isWifiAvailable[Async] : 判断 wifi 数据是否可用
getNetworkOperatorName
getNetworkType
getIPAddress[Async] : 获取 IP 地址
getDomainAddress[Async] : 获取域名 IP 地址
getIpAddressByWifi
getGatewayByWifi
getNetMaskByWifi
getServerAddressByWifi
registerNetworkStatusChangedListener
isRegisteredNetworkStatusChangedListener
unregisterNetworkStatusChangedListener
getWifiScanResult
addOnWifiChangedConsumer
removeOnWifiChangedConsumer
-
About Notification -> NotificationUtils.java -> Demo
areNotificationsEnabled
notify
cancel
cancelAll
setNotificationBarVisibility
-
About Number -> NumberUtils.java -> Test
format
float2Double
-
About Object -> ObjectUtils.java -> Test
isEmpty
isNotEmpty
equals
compare
requireNonNull(s)
getOrDefault
toString
hashCode(s)
-
About Path -> PathUtils.java -> Demo
join
getRootPath
getDataPath
getDownloadCachePath
getInternalAppDataPath
getInternalAppCodeCacheDir
getInternalAppCachePath
getInternalAppDbsPath
getInternalAppDbPath
getInternalAppFilesPath
getInternalAppSpPath
getInternalAppNoBackupFilesPath
getExternalStoragePath
getExternalMusicPath
getExternalPodcastsPath
getExternalRingtonesPath
getExternalAlarmsPath
getExternalNotificationsPath
getExternalPicturesPath
getExternalMoviesPath
getExternalDownloadsPath
getExternalDcimPath
getExternalDocumentsPath
getExternalAppDataPath
getExternalAppCachePath
getExternalAppFilesPath
getExternalAppMusicPath
getExternalAppPodcastsPath
getExternalAppRingtonesPath
getExternalAppAlarmsPath
getExternalAppNotificationsPath
getExternalAppPicturesPath
getExternalAppMoviesPath
getExternalAppDownloadPath
getExternalAppDcimPath
getExternalAppDocumentsPath
getExternalAppObbPath
getRootPathExternalFirst
getAppDataPathExternalFirst
getFilesPathExternalFirst
getCachePathExternalFirst
-
About Permission -> PermissionUtils.java -> Demo
permission
permissionGroup
permission.explain
permission.rationale
permission.callback
permission.theme
permission.request
getPermissions
isGranted
isGrantedWriteSettings
requestWriteSettings
isGrantedDrawOverlays
requestDrawOverlays
launchAppDetailsSettings
-
About Phone -> PhoneUtils.java -> Demo
isPhone
getDeviceId
getSerial
getIMEI
getMEID
getIMSI
getPhoneType
isSimCardReady
getSimOperatorName
getSimOperatorByMnc
dial
call
sendSms
-
About Process -> ProcessUtils.java -> Demo
getForegroundProcessName
killAllBackgroundProcesses
killBackgroundProcesses
isMainProcess
getCurrentProcessName
-
About Reflect -> ReflectUtils.java -> Test
reflect
newInstance
field
method
get
-
About Regex -> RegexUtils.java -> Test
isMobileSimple
isMobileExact
isTel
isIDCard15
isIDCard18
isIDCard18Exact
isEmail
isURL
isZh
isUsername
isDate
isIP
isMatch
getMatches
getSplits
getReplaceFirst
getReplaceAll
RegexConstants.REGEX_DOUBLE_BYTE_CHAR
RegexConstants.REGEX_BLANK_LINE
RegexConstants.REGEX_QQ_NUM
RegexConstants.REGEX_CHINA_POSTAL_CODE
RegexConstants.REGEX_INTEGER
RegexConstants.REGEX_POSITIVE_INTEGER
RegexConstants.REGEX_NEGATIVE_INTEGER
RegexConstants.REGEX_NOT_NEGATIVE_INTEGER
RegexConstants.REGEX_NOT_POSITIVE_INTEGER
RegexConstants.REGEX_FLOAT
RegexConstants.REGEX_POSITIVE_FLOAT
RegexConstants.REGEX_NEGATIVE_FLOAT
RegexConstants.REGEX_NOT_NEGATIVE_FLOAT
RegexConstants.REGEX_NOT_POSITIVE_FLOAT
-
About Resource -> ResourceUtils.java -> Demo
getDrawable
getIdByName
getStringIdByName
getColorIdByName
getDimenIdByName
getDrawableIdByName
getMipmapIdByName
getLayoutIdByName
getStyleIdByName
getAnimIdByName
getMenuIdByName
copyFileFromAssets
readAssets2String
readAssets2List
copyFileFromRaw
readRaw2String
readRaw2List
-
About Rom -> RomUtils.java -> Demo
isHuawei
isVivo
isXiaomi
isOppo
isLeeco
is360
isZte
isOneplus
isNubia
isCoolpad
isLg
isGoogle
isSamsung
isMeizu
isLenovo
isSmartisan
isHtc
isSony
isGionee
isMotorola
getRomInfo
-
About Screen -> ScreenUtils.java -> Demo
getScreenWidth
getScreenHeight
getAppScreenWidth
getAppScreenHeight
getScreenDensity
getScreenDensityDpi
setFullScreen
setNonFullScreen
toggleFullScreen
isFullScreen
setLandscape
setPortrait
isLandscape
isPortrait
getScreenRotation
screenShot
isScreenLock
setSleepDuration
getSleepDuration
-
About SDCard -> SDCardUtils.java -> Demo
isSDCardEnableByEnvironment
getSDCardPathByEnvironment
getSDCardInfo
getMountedSDCardPath
getExternalTotalSize
getExternalAvailableSize
getInternalTotalSize
getInternalAvailableSize
-
About Service -> ServiceUtils.java
getAllRunningServices
startService
stopService
bindService
unbindService
isServiceRunning
-
About Shadow -> ShadowUtils.java -> Demo
apply
-
About Shell -> ShellUtils.java
execCmd[Async]: 执行命令
-
About Size -> SizeUtils.java
dp2px, px2dp
sp2px, px2sp
applyDimension
forceGetViewSize
measureView
getMeasuredWidth
getMeasuredHeight
-
About Snackbar -> SnackbarUtils.java -> Demo
with
setMessage
setMessageColor
setBgColor
setBgResource
setDuration
setAction
setBottomMargin
show
showSuccess
showWarning
showError
dismiss
getView
addView
-
About Span -> SpanUtils.java -> Demo
with
setFlag
setForegroundColor
setBackgroundColor
setLineHeight
setQuoteColor
setLeadingMargin
setBullet
setFontSize
setFontProportion
setFontXProportion
setStrikethrough
setUnderline
setSuperscript
setSubscript
setBold
setItalic
setBoldItalic
setFontFamily
setTypeface
setAlign
setClickSpan
setUrl
setBlur
setShader
setShadow
setSpans
append
appendLine
appendImage
appendSpace
create
-
About SPStatic -> SPStaticUtils.java -> Demo
setDefaultSPUtils
put
getString
getInt
getLong
getFloat
getBoolean
getAll
contains
remove
clear
-
About SP -> SPUtils.java
getInstance
Instance.put
Instance.getString
Instance.getInt
Instance.getLong
Instance.getFloat
Instance.getBoolean
Instance.getAll
Instance.contains
Instance.remove
Instance.clear
-
About String -> StringUtils.java -> Test
isEmpty
isTrimEmpty
isSpace
equals
equalsIgnoreCase
null2Length0
length
upperFirstLetter
lowerFirstLetter
reverse
toDBC
toSBC
getString
getStringArray
format
-
About Thread -> ThreadUtils.java -> Test
isMainThread
getMainHandler
runOnUiThread
runOnUiThreadDelayed
getFixedPool
getSinglePool
getCachedPool
getIoPool
getCpuPool
executeByFixed
executeByFixedWithDelay
executeByFixedAtFixRate
executeBySingle
executeBySingleWithDelay
executeBySingleAtFixRate
executeByCached
executeByCachedWithDelay
executeByCachedAtFixRate
executeByIo
executeByIoWithDelay
executeByIoAtFixRate
executeByCpu
executeByCpuWithDelay
executeByCpuAtFixRate
executeByCustom
executeByCustomWithDelay
executeByCustomAtFixRate
cancel
setDeliver
-
About Time -> TimeUtils.java -> Test
getSafeDateFormat
millis2String
string2Millis
string2Date
date2String
date2Millis
millis2Date
getTimeSpan
getFitTimeSpan
getNowMills
getNowString
getNowDate
getTimeSpanByNow
getFitTimeSpanByNow
getFriendlyTimeSpanByNow
getMillis
getString
getDate
getMillisByNow
getStringByNow
getDateByNow
isToday
isLeapYear
getChineseWeek
getUSWeek
isAm
isPm
getValueByCalendarField
getChineseZodiac
getZodiac
-
About Toast -> ToastUtils.java -> Demo
make
make.setMode
make.setGravity
make.setBgColor
make.setBgResource
make.setTextColor
make.setTextSize
make.setDurationIsLong
make.setLeftIcon
make.setTopIcon
make.setRightIcon
make.setBottomIcon
make.setNotUseSystemToast
make.show
getDefaultMaker
showShort
showLong
cancel
-
About Touch -> TouchUtils.java
setOnTouchListener
-
About UiMessage -> UiMessageUtils.java -> Demo
send
addListener
removeListener
-
About Uri -> UriUtils.java
res2Uri
file2Uri
uri2File
uri2FileNoCacheCopy
uri2Bytes
-
UtilsTransActivity -> UtilsTransActivity.java
start
-
UtilsTransActivity4MainProcess -> UtilsTransActivity4MainProcess.java
start
-
About Vibrate -> VibrateUtils.java -> Demo
vibrate
cancel
-
About View -> ViewUtils.java
setViewEnabled
runOnUiThread
runOnUiThreadDelayed
isLayoutRtl
fixScrollViewTopping
layoutId2View
-
About Volume -> VolumeUtils.java
getVolume
setVolume
getMaxVolume
getMinVolume
-
About Zip -> ZipUtils.java -> Test
zipFiles
zipFile
unzipFile
unzipFileByKeyword
getFilesPath
getComments