Skip to content

Instantly share code, notes, and snippets.

@ozcankrks
Created May 5, 2020 19:51
Show Gist options
  • Select an option

  • Save ozcankrks/b15b9d8556b4a960b0fd4a8f4d15259d to your computer and use it in GitHub Desktop.

Select an option

Save ozcankrks/b15b9d8556b4a960b0fd4a8f4d15259d to your computer and use it in GitHub Desktop.
public String GetJsonData(String _url) throws IOException
{
StringBuilder sb = new StringBuilder();
URL uri = new URL(_url); // Veri urlniz
HttpURLConnection urlConnection = (HttpURLConnection) uri.openConnection();
try {
InputStream in = new BufferedInputStream(urlConnection.getInputStream());
BufferedReader bin = new BufferedReader(new InputStreamReader(in));
String inputLine;
while ((inputLine = bin.readLine())!= null)
{
sb.append(inputLine);
}
}
finally
{
urlConnection.disconnect();
}
Log.d("çıktı",sb.toString());
return sb.toString();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment