I want to pass these parameters to a rest api with the method POST
and have it send me a status of whether it found the username and password in its database, but I don't know how to send the data.
if(method.equals("POST")){
http.setRequestProperty("Content-type","application/x-wwww-form-urlencode");
http.setDoInput(true);
Uri.Builder params=new Uri.Builder()
.appendQueryParameter("usuario",usuario)
.appendQueryParameter("clave",contrasena);
To make your request it is important that you do not make it in the main thread, therefore I suggest you use an Asynctask:
You would make the request like this: