Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void registerProcess(String studentName, String studentAddress, String studentEmail, String studentPhone, String department, String batch_id, String student_id, String rePassword) {
- apiInterface = RetrofitApiClient.getClient().create(ApiInterface.class);
- StudentModel student = new StudentModel();
- student.setStudent_name(studentName);
- student.setStudent_address(studentAddress);
- student.setStudent_email(studentEmail);
- student.setStudent_phone(studentPhone);
- student.setDept_code(department);
- student.setBatch_id(batch_id);
- student.setStudent_id(student_id);
- student.setPassword(rePassword);
- Log.e(TAG,student.toString());
- ServerRequest request = new ServerRequest();
- request.setOperation(Config_Ref.REGISTER_OPERATION);
- request.setStudentModel(student);
- Call<ServerResponse> response = apiInterface.operation(request);
- response.enqueue(new Callback<ServerResponse>() {
- @Override
- public void onResponse(Call<ServerResponse> call, Response<ServerResponse> response) {
- if(response.isSuccessful()){
- ServerResponse resp = response.body();
- Toast.makeText(RegisterActivity.this, resp.getMessage()+" success", Toast.LENGTH_SHORT).show();
- Log.e(TAG,resp.getMessage()+" success");
- }else{
- Toast.makeText(RegisterActivity.this, response.message()+" not success", Toast.LENGTH_SHORT).show();
- Log.e(TAG,response.message()+" not success");
- }
- /* Snackbar.make(fview, resp.getMessage(), Snackbar.LENGTH_LONG).show();*/
- //pDialog.dismiss();
- }
- @Override
- public void onFailure(Call<ServerResponse> call, Throwable t) {
- /*Snackbar.make(fview, t.getLocalizedMessage(), Snackbar.LENGTH_LONG).show();*/
- Toast.makeText(RegisterActivity.this, t.getLocalizedMessage()+" failed"+call.toString(), Toast.LENGTH_SHORT).show();
- Log.e(TAG,t.getLocalizedMessage()+" failed");
- }
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement