Hello
I am implementing a code to register a user from the application with the api users but I get a fatal error and you tell me if I'm right or wrong
I leave the code:
registerButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
User user = new User();
user.setName(nameInput.getText().toString());
user.setEmail(emailInput.getText().toString());
user.setPassword(passwordInput.getText().toString());
final MainApplication application = (MainApplication) getActivity().getApplication();
final WebService service = application.getService();
service.createUser(user).enqueue(new WebServiceCallback<User>(getContext()) {
@Override
public void onSuccess(Response<User> response) {
if (response.isSuccessful()){
String message = "Register Successful";
Toast.makeText(getContext(), message, Toast.LENGTH_LONG).show();
}
}
});
@POST("/api/users")
Call<User> createUser(@Body User user);
Regards.
Do you have two user accounts here?
help, I get a bad request when registering
Who is Seba and why you posted exactly the same question at the same time?
Hello
I am implementing a code to register a user from the application with the api users but I get a fatal error and you tell me if I'm right or wrong
I leave the code:
registerButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { User user = new User(); user.setName(nameInput.getText().toString()); user.setEmail(emailInput.getText().toString()); user.setPassword(passwordInput.getText().toString()); final MainApplication application = (MainApplication) getActivity().getApplication(); final WebService service = application.getService(); service.createUser(user).enqueue(new WebServiceCallback<User>(getContext()) { @Override public void onSuccess(Response<User> response) { if (response.isSuccessful()){ String message = "Register Successful"; Toast.makeText(getContext(), message, Toast.LENGTH_LONG).show(); } } }); @POST("/api/users") Call<User> createUser(@Body User user);
Regards.