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
1 ответ
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)