yasarsalim

server

Aug 20th, 2016
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.52 KB | None | 0 0
  1.  public void checklogin(View view) {
  2.  
  3.         // Get text from username and passord field
  4.         final String username = id.getText().toString();
  5.         final String password = pwd.getText().toString();
  6.         if (username.length()==0){
  7.             status.setText("Please enter userid");
  8.         }
  9.         else if(password.length()==0){
  10.             status.setText("Please enter password");
  11.         }
  12.         else {
  13.             StringRequest stringRequest = new StringRequest(Request.Method.POST, REGISTER_URL,
  14.                     new Response.Listener<String>() {
  15.                         @Override
  16.                         public void onResponse(String response) {
  17.                             status.setText(response+"ss");
  18.                         }
  19.                     },
  20.                     new Response.ErrorListener() {
  21.                         @Override
  22.                         public void onErrorResponse(VolleyError error) {
  23.                             status.setText(error.toString());
  24.                         }
  25.                     }){
  26.                 @Override
  27.                 protected Map<String,String> getParams(){
  28.                     Map<String,String> params = new HashMap<String, String>();
  29.                     params.put("id",username);
  30.                     params.put("pwd",password);
  31.                     return params;
  32.                 }
  33.  
  34.             };
  35.  
  36.             RequestQueue requestQueue = Volley.newRequestQueue(MainActivity.this);
  37.             requestQueue.add(stringRequest);
  38.         }
  39.     }
Add Comment
Please, Sign In to add comment