This is my code
public void loginRequestAsync() {
OkHttpClient client = new OkHttpClient();
HttpUrl.Builder urlBuilder = HttpUrl.parse("xxx.xxxx.xx.x.xx.xxx.x").newBuilder();
String url = urlBuilder.build().toString();
RequestBody requestBody = new MultipartBody.Builder()
.setType(MultipartBody.FORM)
.addFormDataPart("ddi", String.valueOf(ddi.getText()))
.addFormDataPart("numero", String.valueOf(numero.getText()))
.build();
Request request = new Request.Builder()
.url(url)
.post(requestBody)
.build();
client.newCall(request).enqueue(new Callback() {
@Override
public void onFailure(Call call, IOException e) {
}
@Override
public void onResponse(Call call, Response response) throws IOException {
Log.d("Response: ",response.body().string());
}
});
}