I am trying to convert the connection string to buffer input stream and then to string so that I can change it to json format but while debugging the program doesn't proceed after
in = new BufferedInputStream(conn.getInputStream());
and directly goes to return statement. Please help.
I followed this article : https://www.tutorialspoint.com/android/android_json_parser.htm
public String makeServiceCall(String input_url)
{
String response=null;
InputStream in=null;
StringBuffer sb = new StringBuffer();
try {
URL url= new URL(input_url);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
in = new BufferedInputStream(conn.getInputStream());
BufferedReader br = new BufferedReader(new InputStreamReader(in,"UTF-8"));
String inputLine = "";
while ((inputLine = br.readLine()) != null) {
sb.append(inputLine);
}
response = sb.toString();
}
catch (MalformedURLException e) {
Log.e(TAG, "MalformedURLException: " + e.getMessage());
}
catch (ProtocolException e) {
Log.e(TAG, "ProtocolException: " + e.getMessage());
}
catch (IOException e) {
Log.e(TAG, "IOException: " + e.getMessage());
}
catch (Exception e) {
Log.e(TAG, "Exception: " + e.getMessage());
}
return response;
}