On the desktop, everything works in the application. In the manifest internet access added. I use this method:

public static String request(String url) throws IOException{ URL obj = new URL(url); HttpURLConnection connection = (HttpURLConnection) obj.openConnection(); connection.setRequestMethod("GET"); BufferedReader in = new BufferedReader(new InputStreamReader (connection.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); inputLine = in.readLine(); response.append(inputLine); in.close(); String actual = response.toString().trim(); return actual; } 
  • What exactly way is expressed inoperability? - Dmitriy
  • one
    I hope you know that in android you can not work with the network in the main stream? - woesss
  • To work with the network to create a separate stream? - Electron
  • Asynctask or library aquery or similar - axmed2004

0