Skip to content

Instantly share code, notes, and snippets.

@kolmakovruslan
Created February 9, 2018 16:04
Show Gist options
  • Select an option

  • Save kolmakovruslan/f65c55254294f8f8490161dc96b80c84 to your computer and use it in GitHub Desktop.

Select an option

Save kolmakovruslan/f65c55254294f8f8490161dc96b80c84 to your computer and use it in GitHub Desktop.
Thread(Runnable {
val client = OkHttpClient()
val request = Request.Builder()
.url("https://api.github.com/users/square/repos")
.build()
val response = client.newCall(request).execute()
val responseText = response.body()!!.string()
val repos = Gson().fromJson(responseText, GitHubRepositoryInfo.List::class.java)
android.util.Log.d("Repos", repos.joinToString { it.name })
}).start()
data class GitHubRepositoryInfo(val name: String) {
class List : ArrayList<GitHubRepositoryInfo>()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment