The most comprehensive Android development tools and most comprehensive android tools

Source: Internet
Author: User
Tags response code

The most comprehensive Android development tools and most comprehensive android tools

This section mainly describes the commonly used tool classes in Android development, most of which are also applicable to Java.

Currently, HttpUtils, DownloadManagerPro, and Safe. ijiami, ShellUtils, delimiter, delimiter, JSONUtils, FileUtils, ResourceUtils, StringUtils, ParcelUtils, delimiter, ArrayUtils, ImageUtils, delimiter, MapUtils, ObjectUtils, delimiter, utils, TimeUtils.

1. HttpUtils
The Http network tool class mainly includes httpGet, httpPost, and http parameter-related methods. Take httpGet as an example:
Static HttpResponse httpGet (HttpRequest request)
Static HttpResponse httpGet (java. lang. String httpUrl)
Static String httpGetString (String httpUrl)
The preceding three methods are used. gzip compression is used by default and bufferedReader is used to increase the read speed.
You can set url, timeout, userAgent, and other http parameters in HttpRequest.
The returned content, http response code, and http expiration time (max-age and expires of Cache-Control) can be obtained in HttpResponse.
The first two methods can be used to set advanced parameters and return rich content. The third method can be used to pass in a url to obtain the returned content. httpPost is similar. For more detailed settings, you can directly use HttpURLConnection or HttpClient of apache.
For more information about the source code, see HttpUtils. java. For more information about the methods and parameters, see HttpUtils Api Guide.

2. DownloadManagerPro
DownloadManager Enhancement Method for Android download management, which can be used to obtain download-related information, such:
GetStatusById (long) to get the Download Status
GetDownloadBytes (long) obtains the download progress.
GetBytesAndStatus (long) to get the download progress and status
GetFileName (long)
GetUri (long) to get the downloaded uri
GetReason (long) causes download failure or suspension
GetPausedReason (long) causes the download to be paused
GetErrorCode (long) gets the download error code.
The source code can be seen in DownloadManagerPro. java. For more information about methods and parameters, see DownloadManagerPro Api Guide. For Android DownManager, use the visible DownManager Demo.

3. Safe. ijiami

Android vulnerability detection tool uploads Android apk online, detects some vulnerabilities that are easily exploited and attacked by hackers during apk development, and proposes corresponding solutions based on the existing vulnerabilities, A detailed analysis report is generated with one click, so that Android Developers can clearly understand the vulnerabilities in their Android applications and take timely measures to protect them.

See http://safe.ijiami.cn for details, solutions for various applications see http://www.ijiami.cn/appprotect_mobile_games

4. ShellUtils
Android Shell tool class, which can be used to check system root permissions and run shell commands under shell or root users. For example, checkRootPermission () Checks root permission execCommand (String [] commands, boolean isRoot, boolean isNeedResultMsg) shell environment to execute commands. The second parameter indicates whether the root permission is used to execCommand (String command, boolean isRoot) run commands in shell Environment
The source code can be seen in ShellUtils. java. For more methods and more details about parameters, see the ShellUtils Api Guide.

5. PackageUtils
Android package-related tool class, which can be used to (root) install an application, (root) uninstall an application, and determine whether the application is a system application, for example, install (Context, String) install an application, if the application is a system application or has root, the installation is silent. Otherwise, the uninstall (Context, String) command is generally installed to uninstall the application. If the application is a system application or has root, the application is uninstalled silently, otherwise, uninstall isSystemApplication (Context, String) to determine whether the application is a system application.
For the source code, see PackageUtils. java. For more information about methods and parameters, see the ShellUtils Api Guide.

6. PreferencesUtils
Android SharedPreferences tool class, which can be used to easily read and write data of the corresponding type to SharedPreferences, such as putString (Context, String, String) to save data of the string type
PutInt (Context, String, int) saves int type data
GetString (Context, String)
GetInt (Context, String)
You can modify the preference name by modifying the PREFERENCE_NAME variable.
For the source code, see PreferencesUtils. java. For more information about methods and parameters, see the PreferencesUtils Api Guide.

7. JSONUtils
JSONUtils tool class, which can be used to easily read and write data of relevant types to Json, such:
String getString (JSONObject jsonObject, String key, String defaultValue)
String getString (String jsonData, String key, String defaultValue)
Reads the value of a String key from json.

GetMap (JSONObject jsonObject, String key)

GetMap (String jsonData, String key)
Reads the value of a Map key from json.
For the source code, see JSONUtils. java. For more information about methods and parameters, see JSONUtils Api Guide.

8. FileUtils
File tool class, which can be used to read and write files and perform operations on files. For example:
ReadFile (String filePath)
WriteFile (String filePath, String content, boolean append) writes a file
GetFileSize (String path) to get the file size
DeleteFile (String path): delete an object
For more information about the source code, see FileUtils. java. For more information about the methods and parameters, see FileUtils Api Guide.

9. ResourceUtils
Android Resource tool class, which can be used to read content from the raw and assets directories of the android Resource Directory, such:
GeFileFromAssets (Context context, String fileName) to get the content of a file in the assets Directory.
GeFileFromRaw (Context context, int resId) obtains the content of a file in the raw directory.
The source code can be seen in ResourceUtils. java. For more methods and detailed parameters, see ResourceUtils Api Guide.

10. StringUtils
String tool class, which can be used for common String operations, such:
IsEmpty (String str) determines whether the String is null or the length is 0
IsBlank (String str) determines whether the String is null, whether the length is 0, or whether it is composed of spaces.
Utf8Encode (String str) is UTF-8 encoded
CapitalizeFirstLetter (String str) is capitalized.
For more information about the source code, see StringUtils. java. For more information about the methods and parameters, see StringUtils Api Guide.

11. ParcelUtils
Android Parcel tool class, which can be used to read or write special types of data from parcel, for example:
ReadBoolean (Parcel in) reads boolean data from pacel
ReadHashMap (Parcel in, ClassLoader loader) reads map-type data from pacel
WriteBoolean (boolean B, Parcel out) writes boolean data to parcel.
WriteHashMap (Map <K, V> map, Parcel out, int flags) writes map data to parcel.
For the source code, see ParcelUtils. java. For more information about methods and parameters, see ParcelUtils Api Guide.

 12. RandomUtils
The random number tool can be used to obtain random numbers within fixed characters, such:
GetRandom (char [] sourceChar, int length) generates a random string, all characters in a string
GetRandomNumbers (int length) generates random numbers
The source code can be seen in RandomUtils. java. For more information about methods and parameters, see the RandomUtils Api Guide.

13. ArrayUtils
Array tool class, which can be used for common array operations, such:
IsEmpty (V [] sourceArray) determines whether the array is null or the length is 0
GetLast (V [] sourceArray, V value, V defaultValue, boolean isCircle) obtains the first element of an array. isCircle indicates whether to loop.
GetNext (V [] sourceArray, V value, V defaultValue, boolean isCircle) to obtain the next element of an array. isCircle indicates whether to loop.
For more information about the source code, see ArrayUtils. java. For more information about the methods and parameters, see ArrayUtils Api Guide.

14. ImageUtils
The image tool class can be used for Bitmap, byte array, and Drawable conversion and image scaling. Currently, the function is weak and will be enhanced later. For example:
BitmapToDrawable (Bitmap B) bimap to drawable
DrawableToBitmap (Drawable d) drawable to bitmap
DrawableToByte (Drawable d) drawable to byte
ScaleImage (Bitmap org, float scaleWidth, float scaleHeight) Scaling Image
For more information about the source code, see ImageUtils. java. For more information about the methods and parameters, see ImageUtils Api Guide.

15. ListUtils
List tool class, which can be used for List common operations, such:
IsEmpty (List <V> sourceList)
Join (List <String> list, String separator) List is converted to a String and separated by a fixed separator.
AddDistinctEntry (List <V> sourceList, V entry) add non-repeating elements to the list
For the source code, see ListUtils. java. For more methods and detailed parameter descriptions, see ListUtils Api Guide.

16. MapUtils
Map tool class, which can be used for common Map operations, such:
IsEmpty (Map <K, V> sourceMap) determines whether the map is null or the length is 0 parseKeyAndValueToMap (String source, String keyAndValueSeparator, String keyAndValuePairSeparator, boolean ignoreSpace) String is parsed as map
ToJson (Map <String, String> map) map to json format
For more information about the source code, see MapUtils. java. For more information about the methods and parameters, see MapUtils Api Guide.

17. ObjectUtils
Object tool class, which can be used for Common Object operations, such:
IsEquals (Object actual, Object expected) compares whether two objects are equal
Compare (V v1, V v2) compares the sizes of two objects
TransformIntArray (int [] source) Integer array to int Array
The source code can be seen in ObjectUtils. java. For more information about methods and parameters, see the ObjectUtils Api Guide.

18. SerializeUtils
Serialization tool class, which can be used to serialize an object to a file or deserialize an object from a file, such:
Deserialization (String filePath) deserializes objects from a file
Serialization (String filePath, Object obj) serializes an Object to a file
For the source code, see SerializeUtils. java. For more information about methods and parameters, see SerializeUtils Api Guide.

19. SystemUtils
The system information tool class can be used to obtain the proper size of the thread pool. Currently, the function is weak and will be enhanced later. For example:
Getdefathreadthreadpoolsize () obtains the size of the thread pool consistent with the system configuration.
For more information about the source code, see SystemUtils. java. For more information about the methods and parameters, see SystemUtils Api Guide.

20. TimeUtils
Time tool class, which can be used for time-related operations, such:
GetCurrentTimeInLong () returns the current time.
GetTime (long timeInMillis, SimpleDateFormat dateFormat) converts long to a fixed format time string
For more information about the source code, see TimeUtils. java. For more information about the methods and parameters, see the TimeUtils Api Guide.

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.