2 回答

TA贡献1853条经验 获得超6个赞
使用 Void 而不是空类
public void sendPost(MultipartBody.Part txt) {
mAPIService.savePost(txt).enqueue(new Callback<Void>() {
@Override
public void onResponse(Call<Void> call, Response<Void> response) {
if(response.isSuccessful()) {
Log.i("TAG", "post submitted to API." + response.body().toString());
}
}
@Override
public void onFailure(Call<Void> call, Throwable t) {
Log.e("TAG", "Unable to submit post to API.");
}
});
}
Request body
RequestBody fbody = RequestBody.create(MediaType.parse("text/*"), file);
builder.addFormDataPart("scontrino", file.getName(),fbody);
添加回答
举报