Skip to content

A Simple Synchronous HTTP Wrapper Library for Android. Using HttpUrlConnection. Easy and Flexible.

License

Notifications You must be signed in to change notification settings

achaly/AndroidNetworkRequest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AndroidNetworkRequest

A Simple Synchronous HTTP Wrapper Library for Android. Using HttpUrlConnection. Easy and Flexible.

Use

StringRequest and JsonRequest can be find in DemoActivity.

Sample:

new AsyncTask<Void, Void, String>() {

        @Override
        protected void onPreExecute() {
            super.onPreExecute();
        }

        @Override
        protected String doInBackground(Void... params) {
            StringRequest request = new StringRequest("https://www.google.com");
            int statusCode = request.getStatus();
            switch (statusCode) {
                case Request.STATUS_OK: {
                    return request.getResponseResult();
                }
                case Request.STATUS_NETWORK_UNAVAILABLE: {
                    return "STATUS_NETWORK_UNAVAILABLE";
                }
                case Request.STATUS_NOT_MODIFIED: {
                    return "STATUS_NOT_MODIFIED";
                }
                default: {
                    return "STATUS_UNKNOWN";
                }
            }
        }

        @Override
        protected void onPostExecute(String s) {
            textView2.setText(s);
        }

}.execute();

About

A Simple Synchronous HTTP Wrapper Library for Android. Using HttpUrlConnection. Easy and Flexible.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages