I am using retrofit API in one of my app. Below is the code :-
for(int i=0; i< mFileArrayList.size();i++){
WebServiceManager.getInstance().getFrogService().postNotes("HI", "Hello", "Done", new Callback<NotesResponse>() {
@Override
public void success(NotesResponse response, retrofit.client.Response response2) {
System.out.println(response);
Toast.makeText(AllKPIActivity.this, "Success", Toast.LENGTH_SHORT).show();
}
@Override
public void failure(RetrofitError error) {
System.out.println(error);
Toast.makeText(AllKPIActivity.this, "Fail", Toast.LENGTH_SHORT).show();
}
});
}
What is happening is sometime before success comes, loop goes ahead and failure comes. What i want is when first success comes, then only the loop moves ahead. Please help, how can i achieve this?