Advertisement
Guest User

Untitled

a guest
Jan 24th, 2017
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. private void userLogin() {
  2. username = usernameField.getText().toString().trim();
  3. password = passwordField.getText().toString().trim();
  4.  
  5. RequestQueue queue = Volley.newRequestQueue(this);
  6.  
  7. // Request a string response from the provided URL.
  8. StringRequest stringRequest = new StringRequest(Request.Method.GET, LOGIN_URL,
  9. new Response.Listener<String>() {
  10. @Override
  11. public void onResponse(String response) {
  12. Toast toast = Toast.makeText(getApplicationContext(), (response), Toast.LENGTH_SHORT);
  13. toast.show();
  14. }
  15. }, new Response.ErrorListener() {
  16. @Override
  17. public void onErrorResponse(VolleyError error) {
  18. Toast toast = Toast.makeText(getApplicationContext(), "Anything doesn't work!", Toast.LENGTH_SHORT);
  19. toast.show();
  20. }
  21. });
  22. // Add the request to the RequestQueue.
  23. queue.add(stringRequest);
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement