Skip to content

Instantly share code, notes, and snippets.

View abethcrane's full-sized avatar

Beth Crane ✨ abethcrane

View GitHub Profile
@hnaoto
hnaoto / BooksActivity.java
Last active November 2, 2021 21:52
Make HTTP request and parse JSON data from Android by using HttpURLConnection
//The original sample is from here: http://syntx.io/how-to-send-an-http-request-from-android-using-httpurlconnection/
//Deprecated funcitons and non-working code are modeifed.
//For more reference, please visit: http://developer.android.com/reference/java/net/HttpURLConnection.html
//I am using Google Books APIs for this sample.
//The returned book objects might have different format according to the language/country. (The second book obejct in data.json is the Japanese version)
//execute the AsyncTask some place in the UI thread
//new CatalogClient().execute("https://www.googleapis.com/books/v1/mylibrary/bookshelves/3/volumes?country=US");