Share an Android Activity_java with a variety of tool classes

Source: Internet
Author: User

An Android activity that has a variety of tool classes built into it. To use, let your activity inherit this activity, all kinds of convenience, easy to understand I wrote a detailed comment on each method, added the network section, added the form file one key to upload

Demo diagram

Code

void Call (java.lang.String number) The method of calling = Telephone void download (java.lang.String URL, netresult result) the function used to download the file Java.lang . String formatmemorysize (long memorysize) formats memory in digital form into an easy-to-understand format: 1m,2g,3k void get (java.lang.String URL, netresult result) Send a request to the server via get and return Data java.util.List getallsms () Fetch all SMS Java.util.List getcontacts () Get all contacts java.util.List Gethas  Readsms () get read SMS Java.util.List gethavenotreadsms () get unread SMS Java.io.File getphonedatadirectory () Get the File object of the phone's internal store long Getphonefreesize () Get cell phone free memory space long getphonesize () get total memory space of mobile phone java.util.List getreceivedsms () get received SMS Java.io.File GE Tsdcarddirectory () Gets the file object long Getsdcardfreesize () of the SD card to get the usable size of the SD card long getsdcardsize () to obtain the total size of the SD card java.util.List ge Tsentsms () Gets the message sent Sharedpreferences getsharedpreferences () Gets the default Sharedpreferences object sharedpreferences Getsharedpreferences (java.lang.String sharedpreferencename) Gets the Sharedpreferences object of the name that you set up java.util.List Getsmsbyaddress (java.lang.String search_address) gets the specified numberCode of the SMS void insertcontacts (Contact ... contacts) to the system to insert contacts void Insertsms (SMS ... SMSS) to the system insert SMS Boolean isnetworkuseful ()  Detect if network state is available Boolean issdcarduseful () SD card is useful for void Post (java.lang.String actionurl, java.util.Map params, Java.util.Map Files, netresult netresult) upload file by Post and submit form void Post (java.lang.String url, java.util.Map params, netresult result) Submits data to the server via post and obtains the return data void Putsharedpreferences (Sharedpreferences sharedpreferences, java.lang.String key, Java.lang.Object value) to the specified sharedpreferences store data void putsharedpreferences (java.lang.String key, Java.lang.Object Value) to store data in Sharedpreferences boolean sendsms (java.lang.String number, java.lang.String content) The method of sending SMS void Setsha
Redpreference (sharedpreferences sharedpreferences) sets its own sharedpreferences void show (int layout_id) to display custom prompt information ...
......
....
.. .

The above is the entire contents of this article, I hope you can enjoy.

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.