I would like to do as I get an html code from a website using android studio. This is the code I made, but it will not return anything.
private static String pegarURL(String a) {
StringBuilder b = new StringBuilder();
try {
URL url = new URL(a);
URLConnection urlConnection = url.openConnection();
BufferedReader bufferedReader =
new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
String line;
while ((line = bufferedReader.readLine()) != null) {
b.append(line + "\n");
}
bufferedReader.close();
} catch(Exception e) {
e.printStackTrace();
}
return b.toString();
}
String h = pegarURL("https://www.google.com/");