The code the Android developer had to collect

Source: Internet
Author: User
Tags md5 encryption sha1 encryption timestamp to date

  • App-related →apputils.java
    • Install app Installapp
    • Uninstall app Uninstallapp for the specified package name
    • Get current app information Getappinfo
    • Get all installed app information Getallappsinfo
    • Determine if the app installs Isinstallapp according to the package name
    • Open the app Openappbypackagename for the specified package name
    • Opens the App app information interface for the specified package name Openappinfo
    • Can be used to do app information sharing shareappinfo
    • Determine if the current app is in the foreground or backstage Isappbackground
  • Constant correlation →constutils.java
    • Store related constants
    • Time-dependent constants
    • Regular correlation constants
  • Convert related →convertutils.java→test
    • Convert every 1 bytes to 2 hex characters bytes2hexstring
    • Convert every 2 hex characters to 1 byte hexstring2bytes
    • Chararr Turn Bytearr chars2bytes
    • Bytearr Turn Chararr Bytes2chars
  • Equipment related →deviceutils.java
    • Get device MAC address getmacaddress
    • Get device vendors, such as Xiaomi Getmanufacturer
    • Get the device model, such as MI2SC Getmodel
  • Encoding and decoding related →encodeutils.java→test
    • URL encoding UrlEncode
    • URL decoding UrlDecode
    • BASE64 encoding Base64Encode base64encode2string
    • Base64 decoding Base64decode
    • Base64url Secure Code Base64urlsafeencode
    • HTML Encoding HtmlEncode
    • HTML decoding HtmlDecode
  • encryption and decryption related →encryptutils.java→test
    • MD2 Encryption encryptmd2tostring encryptMD2
    • MD5 Encryption encryptmd5tostring EncryptMD5
    • SHA1 Encryption encryptsha1tostring encryptSHA1
    • SHA224 Encryption encryptsha224tostring encryptSHA224
    • SHA256 Encryption encryptsha256tostring encryptSHA256
    • SHA384 Encryption encryptsha384tostring encryptSHA384
    • SHA512 Encryption encryptsha512tostring encryptSHA512
    • Get the file's MD5 check code encryptmd5file2string encryptmd5file
    • Des is encrypted and converted to BASE64 encoding encryptdes2base64
    • Des encryption converted to 16 binary encryptdes2hexstring
    • DES encryption Encryptdes
    • Des decryption Base64 encoded ciphertext decryptbase64des
    • Des decryption 16 binary ciphertext Decrypthexstringdes
    • Des decryption Decryptdes
    • 3DES encryption after conversion to BASE64 encoding encrypt3des2base64
    • 3DES encryption to 16 binary encrypt3des2hexstring
    • 3DES Encryption Encrypt3des
    • 3DES decryption BASE64 encoded ciphertext decryptbase64_3des
    • 3DES decryption 16 binary ciphertext Decrypthexstring3des
    • 3DES decryption Decrypt3des
    • AES encrypted and converted to BASE64 encoded ENCRYPTAES2BASE64
    • AES encrypted and converted to 16 binary encryptaes2hexstring
    • AES Encryption Encryptaes
    • AES decryption BASE64 encoded ciphertext Decryptbase64aes
    • AES Decryption 16 binary ciphertext Decrypthexstringaes
    • AES Decryption Decryptaes
  • file related →fileutils.java→test
    • Get files based on file path Getfilebypath
    • Determine if a file exists isfileexists
    • Determine if it is a directory Isdir
    • Determine if the file is Isfile
    • Determine if the directory exists and does not exist to determine if the creation succeeded Createorexistsdir
    • Determine if the file exists and does not exist to determine if the creation succeeded Createorexistsfile
    • Determine if the file exists, then delete createfilebydeleteoldfile before creation
    • Copy directory Copydir
    • Copying Files CopyFile
    • Mobile Directory Movedir
    • Move File MoveFile
    • Delete directory Deletedir
    • deleting files DeleteFile
    • Writes an input stream to a file Writefilefromis
    • Writes a string to a file writefilefromstring
    • Simple get file Encoding format getfilecharsetsimple
    • Gets the number of file rows Getfilelines
    • Specify encoding to read files by line to list readfile2list
    • Specifies that the encoding reads files by line into StringBuilder READFILE2SB
    • BYTE Unit conversion (Unit: unit) Byte2unit
    • Get File Size GetFileSize
    • Get the longest directory based on the full path getdirname
    • Get the file name based on the full path GetFileName
    • Get filenames without extension getfilenamenoextension based on full path
    • Get file extension getfileextension based on full path
  • Photo related →imageutils.java
    • Perfecting ing
  • Keyboard-related →keyboardutils.java
    • Avoid IME panel occlusion
    • Dynamic Hide Soft Keyboard hidesoftinput
    • Click on the blank area of the screen to hide the soft keyboard (note Meng Meng da) clickblankarea2hidesoftinput0
    • Dynamic Display soft Keyboard showsoftinput
    • Toggle keyboard display or not status Togglesoftinput
  • Network-related →networkutils.java
    • Open the Network Settings interface openwirelesssettings
    • Determine if the network is available isavailable
    • Determine if the network is connected isconnected
    • Determine if the network is 4G is4g
    • Determine if WiFi connection status iswificonnected
    • Get the mobile network operator name Getnetworkoperatorname
    • Get the mobile terminal type Getphonetype
    • Gets the current network type (WIFI,2G,3G,4G) Getnetworktype Getnetworktypename
  • Mobile related →phoneutils.java
    • Determine if the device is a mobile Isphone
    • Get your phone's Imie Getphoneimei
    • Get Phone status information getphonestatus
    • Jump to the dial-up interface filled with PhoneNumber dial
    • Call PhoneNumber
    • Send SMS Sendsms
    • Get Phone Contact Getallcontactinfo
    • Open the Phone contact screen click on the contact person and then get the number (note Meng Meng) getcontantnum
    • Get SMS messages and save them in XML getallsms
  • Regular related →regularutils.java→test
    • Verify phone number (simple)  ismobilesimple
    • Verify phone number (exact)   Ismobileexact
    • Verify phone number  istel
    • Verify ID number 15-bit  ISIDCARD15
    • Verify ID number 18-bit  isidcard18< /li>
    • Verify Mailbox  isemail
    • Verify url isurl
    • verify kanji  ischz
    • Verify user name  isusername
    • Verifying date checksums in YYYY-MM-DD format, considering flat leap years  isdate
    • Verify IP address  isip
    • string matches regex ismatch
  • Screen-related →screenutils.java
    • Get phone resolution Getdevicewidth, Getdeviceheight
    • Set transparent status bar (API greater than 19 can be used) Settransparentstatusbar
    • Hide the status bar (note Meng Meng da) hidestatusbar
    • Get status bar height Getstatusbarheight
    • Determine if the status bar exists isstatusbarexists
    • Get Actionbar height Getactionbarheight
    • Show Notification Bar Shownotificationbar
    • Hide the notification bar Hidenotificationbar
    • Set the screen as a horizontal screen (note Meng Meng da) setlandscape
    • Get screen Snapshotwithstatusbar, Snapshotwithoutstatusbar
    • Determine if the lock screen Isscreenlock
  • SD Card related →sdcardutils.java
    • Gets whether the device SD card is available issdcardenable
    • Get the device SD card path Getsdcardpath
    • Perfecting ing
  • Shell-related →shellutils.java
    • Determine if the device is root isRoot
    • Whether to execute the command under root execcmd
  • Size related →sizeutils.java
    • DP and PX conversion dp2px, PX2DP
    • SP and px conversion sp2px, PX2SP
    • Various unit conversions Applydimension
    • The size of the view can be forcibly obtained at OnCreate () forcegetviewsize
    • In-Front measurement of view size in the ListView (Note Meng Meng) measureview
  • SP related →sputils.java
    • The SP writes string type value putstring
    • Read string getString in SP
    • The SP writes int type value Putint
    • Read int getInt in SP
    • The SP writes a long type value Putlong
    • Read Long Getlong in SP
    • The SP writes the float type value putfloat
    • Read float getfloat in SP
    • The SP writes the Boolean type value Putboolean
    • Read Boolean Getboolean in SP
  • string-related →stringutils.java→test
    • Determines whether a string is null or has a length of 0 isEmpty
    • Determines whether a string is null or all spaces IsSpace
    • Null to a string of length 0 Null2length0
    • Returns the length of a string
    • Initial Capital Letter Upperfirstletter
    • First Letter Lowercase Lowerfirstletter
    • Convert to half-width character todbc
    • Convert to full-width character TOSBC
  • Time-related →timeutils.java→test
    • Convert timestamp to time string milliseconds2string
    • Convert time string to timestamp string2milliseconds
    • Convert time string to date type String2date
    • Convert date type to time string date2string
    • Convert date type to timestamp date2milliseconds
    • Convert timestamp to date type Milliseconds2date
    • Millisecond Timestamp unit conversion (Unit: unit) Milliseconds2unit
    • Get two time difference (unit: unit) Getintervaltime
    • Get current time Getcurtimemills getcurtimestring getcurtimedate
    • Gets the difference from the current time (unit: unit) Getintervalbynow
    • Judging leap year Isleapyear
  • Uncategorized →unclassifiedutils.java
    • Gets whether the service is turned on Isrunningservice
  • Update log→update_log.md

Do this collation is to use it as an Android development dictionary, when encountered some trivial problems, no longer face to Baidu or Google query API usage, time and effort, there are words, everyone despite the move, but also hope that it can grow day by day, looking forward to everyone's star and Perfect, Of course, I will always update the release version and log, in order to facilitate the import, is now uploaded jcenter; many of the code is the essence of the Hui Quartet, thank the predecessors of the provision, of course, ultimately through unit testing,

Download

Gradle:

[Code]xml Code:
Compile ' com.blankj:utilcode:1.1.1 '

proguard[Code]xml Code:
-keep class com.blankj.utilcode.** {*;} -keepclassmembers class com.blankj.utilcode.** {*;} -dontwarn com.blankj.utilcode.**

Android developers have to collect the code (GO)

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.