Http GET/POST on Java, Android Studio | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Http GET/POST on Java, Android Studio

So Is there any way to use Android Volley or HttpURLconnection library in Java to send a "no parameters" POST request As in just like hitting http://server:local/ledon/ I can do that in browser with ease but how do you code a button action to do that. All the examples i've seen have used parameters

11th Jun 2018, 2:55 PM
Twenty-three
1 Answer
0
(new Thread(new Runnable() { @Override public void run() { try { URL url = new URL(uurrll); HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection(); try { InputStream in = new BufferedInputStream(urlConnection.getInputStream()); BufferedReader r = new BufferedReader(new InputStreamReader(in)); StringBuilder total = new StringBuilder(); String line; while ((line = r.readLine()) != null) { total.append(line); } //TODO: close tags, add catch, handle result (I know its missing some stuff, but I just copied the code from an app of mine)
10th Mar 2020, 7:35 PM
Jakob Meier
Jakob Meier - avatar