Skip to content

Instantly share code, notes, and snippets.

@anirudhamahale
Last active June 2, 2018 11:53
Show Gist options
  • Save anirudhamahale/63ef323c646dfc24098d31ffd8b1d594 to your computer and use it in GitHub Desktop.
Save anirudhamahale/63ef323c646dfc24098d31ffd8b1d594 to your computer and use it in GitHub Desktop.
Retrofit enque function
val apiClient = APIClient().getAPIClient().create(APICallsInterface::class.java)
apiClient.getFeeds().enqueue(object : Callback<ResponseBody> {
override fun onFailure(call: Call<ResponseBody>?, t: Throwable?) {
println("Failed")
}
override fun onResponse(call: Call<ResponseBody>?, response: Response<ResponseBody>?) {
println("Result: ${response!!.body().toString()}")
data = response.body()!!
loadRecyclerView()
}
})
@anirudhamahale
Copy link
Author

val retrofit_version = 2.4.0
implementation 'com.squareup.retrofit2:retrofit:$retrofit_version'
implementation 'com.squareup.retrofit2:converter-gson:$retrofit_version'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment