Skip to content

Instantly share code, notes, and snippets.

@sasssass
Created May 19, 2020 21:48
Show Gist options
  • Save sasssass/4c58d6211e6ecd1eaf6c50f78003bfcb to your computer and use it in GitHub Desktop.
Save sasssass/4c58d6211e6ecd1eaf6c50f78003bfcb to your computer and use it in GitHub Desktop.
class MainActivity : AppCompatActivity() , RemoteErrorEmitter {
val webService : webService = RetrofitBuilder.api
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
var thePosts = apiCall<MutableList<Post>>(this,{webService.getPosts()}).observe(
this,
Observer {
if(it != null)
for (item in it)
{
Log.d("HERE",item.title)
}
}
)
}
override fun onError(msg: String) {
}
override fun onError(errorType: ErrorType) {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment