January 2019
Intermediate to advanced
392 pages
10h 11m
English
Here, we're calling CallBack<> from MainActivity. This callback response comes from a server or offline requests. This means returning the result of a long-running function at a later moment in time.
Check the MainActivity.kt code to use the CallBack function and handle the result:
class MainActivity : AppCompatActivity() { var username: String = "sunnat629" var password: String = "password" override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) val githubService: UserService = UserServiceImpl().getGithubServiceImpl(username,password) val call: Call<List<UserModel>> = githubService.getUserList() call.enqueue(object: Callback<List<UserModel>> { override ...
Read now
Unlock full access