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());
}
}
}
Also in HTML:
- ubuntu vmplayer
- simple html document
- how do you code an image in html
- colspan tag html
- center text in a html file
- number paragraphs in html
- html add vertical space below
- innerhtml jquery
- html2pdf page break option
- how to center text in svg
- nav bar activate in jinja
- a href
- html doctype
- script src tag in html
- doctype html model
- how can i make a quote element in html
- ionic badge
- how to set a var in js to be a download
- excel vba HTML text with tags to formatted text in an cell
- embed Bokeh components to HTML
- jquery replace innerhtml
- search functionality for html table on text box
- how to start a html file
- html timer