Java tutorial
//package com.java2s; import android.util.Log; import java.io.BufferedInputStream; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; public class Main { public static String getJsonCurrencyObject(String myurl) { StringBuilder strBuilder = new StringBuilder(); try { URL url = new URL(myurl); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); InputStream inputStream = new BufferedInputStream(connection.getInputStream()); BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream)); String line; while ((line = reader.readLine()) != null) { strBuilder.append(line); } inputStream.close(); } catch (MalformedURLException ex) { Log.d("HttpURLConnection", "getJsonCurrencyObject: " + ex.getMessage()); } catch (IOException e) { Log.d("readJSONFeed", e.getLocalizedMessage()); e.printStackTrace(); } catch (Exception ex) { Log.d("GeneralException", ex.getMessage()); } return strBuilder.toString(); } }