-2

Actually I am using retrofit inside of project , and I am calling 2 Aysnc requests. but I need that after this requests success to trigger other method. how to know when this request are done and then trigger other method ?

cnkaptan
  • 15
  • 1
  • 7

2 Answers2

1

You can use async Task in android. Here's some important highlights

create an async task

private class MyTask extends AsyncTask<Void, Void, Void> { ... }

it will have 4 methods that you can override.

onPreExecute()
doInBackground(Params...)
onProgressUpdate(Progress...)
onPostExecute(Result)

basically, you just need to put the method that you wanna trigger in the onPostExecute method.

protected void onPostExecute(Long result) {
    //add your method here
}

for more details please refer to android documentation on AsyncTask.

Riandy
  • 372
  • 3
  • 10
0

It seems like you're looking for this:

http://developer.android.com/reference/android/os/AsyncTask.html

SirGregg
  • 100
  • 9