Open source Android Development Framework-------Powerframework Use (v) Network request HttpRequest

Source: Internet
Author: User

Get Request Example

All parameters are using bundles, with putstringbundle bundle = new Bundle (), bundle.putstring ("username", "Rederxuget"), Bundle.putstring ( "Password", "Farmerget");//urlstring url = "http://www.baidu.com";//Initiate request Httprequest.get (This,url, bundle, new Onrequestoverlistener () {    @Override public    void Onrequestover (String result) {        //Returns the result (or error reason)        LOG.E ( "Onrequestover", result);}    );

The POST request is consistent with the GET request, and only the calling method is different.

Post Request Example

All parameters are using bundles, with putstringbundle bundle = new Bundle (), bundle.putstring ("username", "Rederxuget"), Bundle.putstring ( "Password", "Farmerget");//urlstring url = "http://www.baidu.com";//Initiate request Httprequest.post (This,url, bundle, new Onrequestoverlistener () {    @Override public    void Onrequestover (String result) {        //Returns the result (or error reason)        LOG.E ( "Onrequestover", result);}    );

File download

String url = "Http://192.168.1.174:8020/video1.mp4"; String Path = "/mnt/sdcard/"; Httprequest.filedownload (URL, path,true, new Onfiledownloadlistener () {         @Override public    void Ondownloading ( int max, int progress) {        //TODO auto-generated method stub        log.e ("Download Progress", Progress + "/" + max);    }         @Override public    void Ondownloadover (String result) {        log.e ("Download complete, storage location:", result);             });

 File Upload

String uploadurl = "http://192.168.1.174:8020/android/FileUpload.php"; String FilePath = "/mnt/sdcard/screenshot.png"; Httprequest.uploadfile (Uploadurl, FilePath, New Onrequestoverlistener () {    @Override public    Void Onrequestover (String result) {        /////        LOG.E ("upload", result) returned after successful upload of the server;}    );

  

Framework and Demo Files http://www.ideayapai.com/Application/Home/View/default/PowerFamily/index-2.htm

Welcome to Daniel, the great God visit QQ Group to Exchange: 575026537

Open source Android Development Framework-------Powerframework Use (v) Network request HttpRequest

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.