My friend and I decided to learn something new and tried the server-application from the bundle. A friend created everything he needed. He created this link here.

http://java.pareto-marketing.ru/showBD.php

where the data is stored. I need through the link

http://java.pareto-marketing.ru/chat.php?action=delete

Delete data from the server so that on that Json page the answer is null. My code is:

try { URL url = new URL("http://java.pareto-marketing.ru/chat.php?action=delete"); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setConnectTimeout(10000); // ждем 10сек conn.setRequestMethod("POST"); conn.setRequestProperty("User-Agent", "Mozilla/5.0"); conn.connect(); } catch (Exception e) { e.printStackTrace(); } finally { if (urlConnection != null) { urlConnection.disconnect(); } } 

I checked on command

 finish(); 

after each line of code. If you put it after

 conn.connect(); 

The application does not close. So this line is not executed. Why?

  • Maybe because an exception crashes? To determine whether a particular code is running, use the debugger. - temq
  • @temq, not running conn.connect (); - Flippy
  • Permission in the manifesto on the Internet is registered? - Android Android

0