Search
 
SCRIPT & CODE EXAMPLE
 

HTML

post request html android

    public class CallAPI extends AsyncTask<String, String, String> {

        public CallAPI(){
            //set context variables if required
        }

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

         @Override
         protected String doInBackground(String... params) {
            String urlString = params[0]; // URL to call
            String data = params[1]; //data to post
            OutputStream out = null;

            try {
                URL url = new URL(urlString);
                HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
                out = new BufferedOutputStream(urlConnection.getOutputStream());

                BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(out, "UTF-8"));
                writer.write(data);
                writer.flush();
                writer.close();
                out.close();

                urlConnection.connect();
            } catch (Exception e) {
                System.out.println(e.getMessage());
            }
        }
    }
Comment

PREVIOUS NEXT
Code Example
Html :: h1 tag is used for 
Html :: org.hibernate.HibernateException: No CurrentSessionContext configured! hibernate spring 
Html :: spin wheel game html code 
Html :: html <small 
Html :: WebView Dump all html 
Html :: fontawesome 4.7 cdn 
Css :: css limit line text 
Css :: how to blur background color in css 
Css :: remove bullets from ul 
Css :: button style none 
Css :: how to center placeholdr text 
Css :: how to contain an image within a div 
Css :: not clickable css 
Css :: how to use between in media query 
Css :: background image css 
Css :: css remove link border on click 
Css :: center position fixed element 
Css :: media query 
Css :: CSS make image fill whole background 
Css :: css first 
Css :: make text unhighlightable 
Css :: make png image white css 
Css :: mobile responsive css 
Css :: background color semi transparent 
Css :: jquery add css 
Css :: css change image color 
Css :: make text not selectable html js css 
Css :: transition scale 
Css :: css remove list indent 
Css :: aligning form elements to center in css 
ADD CONTENT
Topic
Content
Source link
Name
7+7 =