Guest User

Untitled

a guest
Jan 23rd, 2019
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. private void userSingIn(){
  2.  
  3. String cardId = editcard.getText().toString().trim();
  4.  
  5.  
  6. Retrofit retrofit = new Retrofit.Builder()
  7. .baseUrl(APIUrl.DETAILS_URL)
  8. .addConverterFactory(GsonConverterFactory.create())
  9. .build();
  10.  
  11. APIService service = retrofit.create(APIService.class);
  12.  
  13. final User user = new User();
  14. user.setCardId(cardId);
  15.  
  16. Call<Result> call = service.loginUser(
  17. user.getCardId()
  18.  
  19. );
  20.  
  21. call.enqueue(new Callback<Result>() {
  22. @Override
  23. public void onResponse(Call<Result> call, Response<Result> response) {
  24.  
  25. Toast.makeText(getApplicationContext(), response.body().getPoints(), Toast.LENGTH_LONG).show();
  26. userpass = response.body().getPassword();
  27. points = response.body().getPoints();
  28.  
  29.  
  30. }
  31.  
  32. @Override
  33. public void onFailure(Call<Result> call, Throwable t) {
  34. Toast.makeText(getApplicationContext(), t.getMessage(), Toast.LENGTH_LONG).show();
  35.  
  36. }
  37. });
  38.  
  39.  
  40. }
Add Comment
Please, Sign In to add comment