【发布时间】:2020-01-13 17:43:09
【问题描述】:
请帮我为我提供解决方案,因为我尝试了很多代码并且参考了很多教程,但每个人的结果都不一样。
所以请大家帮帮我
【问题讨论】:
标签: android asp.net web-services retrofit
请帮我为我提供解决方案,因为我尝试了很多代码并且参考了很多教程,但每个人的结果都不一样。
所以请大家帮帮我
【问题讨论】:
标签: android asp.net web-services retrofit
您可以尝试使用 Koush ION,Here is the GitHub,也可以扩展您的问题是否有任何错误,究竟是什么问题......下次您提出问题时,您应该添加代码 sn-ps 和对问题的完整解释......您将有更好的机会获得答案......所以在 koush ION 中,它易于使用
实现库implementation 'com.koushikdutta.ion:ion:2.2.1
然后调用它
Ion.with(SecondActivity.this)
.load(myURL)-Enter your URL here
.uploadProgressDialog(pd)
.setMultipartFile("pdf","pdf/*",filePath )-here you set the type and location of the file
.asJsonObject()
.setCallback(new FutureCallback<JsonObject>() { - here you get results from the server using a json array/object
@Override
public void onCompleted(Exception e, JsonObject result) {
String message = result.get("message").getAsString();
Toasty.info(SecondActivity.this, message, Toast.LENGTH_LONG).show();-here i use the Toasty library for awesome looking toast messages
【讨论】: