什么是Android的相当于该卷曲操作? [英] What is android's equivalent for this curl operation?

查看:118
本文介绍了什么是Android的相当于该卷曲操作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前使用以下Linux命令将文件提交到一个网站:

I'm currently using the following linux command to submit files to a website:

curl --form file=@s1.png --form someparameter=somevalue http://api.website.com/upload.php

我以前从来没有做出一个Android应用程序。但是,有没有在Android SDK中的等价操作?或由于Android开发使用Java做的,也许有什么东西要做到这一点?如果是这样,那是什么?

I have never made an android app before. But is there an equivalent operation in the android SDK? Or since android development is done with Java, perhaps there's something to do this? If so, what is it?

推荐答案

有些人喜欢使用的 HttpURLConnection类

您不会得到在同一行的东西,但它有所有你需要。

You won't get something in one line, but it has all that you would need.

如果您需要更多的东西融为一体prehensive,然后 HttpClient的将是你的胡同。

If you need something more comprehensive, then HttpClient would be up your alley.

更新:

避免HttpClient的! <一href=\"http://developer.android.com/about/versions/marshmallow/android-6.0-changes.html#behavior-apache-http-client\"相对=nofollow>这是德precated 。最常推荐的HTTP库现在是 OkHttp

Avoid HttpClient! It is deprecated. The most commonly recommended Http Library right now is OkHttp.

这篇关于什么是Android的相当于该卷曲操作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆