Advertisement
absjabed

registrationMethod

Dec 21st, 2017
528
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.22 KB | None | 0 0
  1. private void registerProcess(String studentName, String studentAddress, String studentEmail, String studentPhone, String department, String batch_id, String student_id, String rePassword) {
  2.  
  3.         apiInterface = RetrofitApiClient.getClient().create(ApiInterface.class);
  4.      
  5.         StudentModel student = new StudentModel();
  6.         student.setStudent_name(studentName);
  7.         student.setStudent_address(studentAddress);
  8.         student.setStudent_email(studentEmail);
  9.         student.setStudent_phone(studentPhone);
  10.         student.setDept_code(department);
  11.         student.setBatch_id(batch_id);
  12.         student.setStudent_id(student_id);
  13.         student.setPassword(rePassword);
  14.  
  15.         Log.e(TAG,student.toString());
  16.  
  17.         ServerRequest request = new ServerRequest();
  18.  
  19.         request.setOperation(Config_Ref.REGISTER_OPERATION);
  20.         request.setStudentModel(student);
  21.  
  22.         Call<ServerResponse> response = apiInterface.operation(request);
  23.  
  24.         response.enqueue(new Callback<ServerResponse>() {
  25.             @Override
  26.             public void onResponse(Call<ServerResponse> call, Response<ServerResponse> response) {
  27.  
  28.                 if(response.isSuccessful()){
  29.  
  30.                     ServerResponse resp = response.body();
  31.                     Toast.makeText(RegisterActivity.this, resp.getMessage()+" success", Toast.LENGTH_SHORT).show();
  32.                     Log.e(TAG,resp.getMessage()+" success");
  33.                 }else{
  34.                     Toast.makeText(RegisterActivity.this, response.message()+" not success", Toast.LENGTH_SHORT).show();
  35.                     Log.e(TAG,response.message()+" not success");
  36.                 }
  37.                /* Snackbar.make(fview, resp.getMessage(), Snackbar.LENGTH_LONG).show();*/
  38.  
  39.                 //pDialog.dismiss();
  40.             }
  41.  
  42.             @Override
  43.             public void onFailure(Call<ServerResponse> call, Throwable t) {
  44.                 /*Snackbar.make(fview, t.getLocalizedMessage(), Snackbar.LENGTH_LONG).show();*/
  45.                 Toast.makeText(RegisterActivity.this, t.getLocalizedMessage()+" failed"+call.toString(), Toast.LENGTH_SHORT).show();
  46.  
  47.                 Log.e(TAG,t.getLocalizedMessage()+" failed");
  48.             }
  49.         });
  50.  
  51.  
  52.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement