0

A post request is sent to a Spring Boot database.

The error message is E/ERROR: java.io.IOException: Cleartext HTTP traffic to localhost not permitted


 RequestQueue queue = Volley.newRequestQueue(getApplicationContext());

                JSONObject newUserJsonObject = new JSONObject();

                try {
                    newUserJsonObject.put("email", email.getText().toString());
                    newUserJsonObject.put("password", password.getText().toString());
                    newUserJsonObject.put("kanton", kanton.toString());
                    int intAge = Integer.parseInt(age.getText().toString());
                    newUserJsonObject.put("age", intAge);
                } catch (JSONException e) {
                    Log.e("ERROR", e.getMessage());
                }

                JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.POST, url, newUserJsonObject, response -> openLoginActivity(), error -> Log.e("ERROR", error.getMessage()));

                queue.add(jsonObjectRequest);
            }else
                //incorrect
                Toast.makeText(RegisterActivity.this, "WRONG DATA", Toast.LENGTH_SHORT).show();
        }
    });

    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    }

    toLogin.setOnClickListener(v -> openLoginActivity());

thanks for help

Marcin Orlowski
  • 68,918
  • 10
  • 117
  • 136
bschle
  • 1

0 Answers0