Skip to content

Instantly share code, notes, and snippets.

@magdamiu
Last active January 4, 2020 21:58
Show Gist options
  • Save magdamiu/74b216bbafa7dd9814bd13333f1dc5ff to your computer and use it in GitHub Desktop.
Save magdamiu/74b216bbafa7dd9814bd13333f1dc5ff to your computer and use it in GitHub Desktop.
Combine the code and get the list of the users
public class GithubActivity extends AppCompatActivity {
private UsersRepository usersRepository;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_github);
usersRepository = UsersRepository.getInstance();
usersRepository.getUsers(new OnGetUsersCallback() {
@Override
public void onSuccess(List<User> users) {
StringBuilder stringBuilder = new StringBuilder();
for (User user : users) {
stringBuilder.append(user.toString() + " /// ");
}
Logging.show("Github users = ", users.toString());
Toast.makeText(GithubActivity.this, stringBuilder.toString(), Toast.LENGTH_LONG).show();
}
@Override
public void onError() {
Logging.show("error Github users = ", "check the code :D ");
Toast.makeText(GithubActivity.this, "error getting the Github users",
Toast.LENGTH_LONG).show();
}
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment