草庐IT

nameValuePairs

全部标签

java - android 编程 NameValuePair 为 api 23 删除

我一直在关注有关此代码的在线教程。并将使用androidapi23Marshmallow发布googleplay。privateMapdecodeExtras(Stringextras){Mapresults=newHashMap();try{URIrawExtras=newURI("?"+extras);ListextraList=URLEncodedUtils.parse(rawExtras,"UTF-8");for(NameValuePairitem:extraList){Stringname=item.getName();inti=0;while(results.contain

android - 使用 NameValuePair 将整数发送到 HTTP 服务器

我想使用此NameValuePair方法从我的Android客户端向Web服务器发送几个值:publicvoidpostData(){//CreateanewHttpClientandPostHeaderHttpClienthttpclient=newDefaultHttpClient();HttpPosthttppost=newHttpPost("http:/xxxxxxx");try{//AddyourdataListnameValuePairs=newArrayList(1);Stringamount=paymentAmount.getText().toString();Stri

php - 使用 POST android 发送 php 数组

我想通过POST从android向php服务器发送一个php数组,我有这段代码HttpClienthttpclient=newDefaultHttpClient();HttpPosthttppost=newHttpPost(url);StringEntitydades=newStringEntity(data);httppost.setEntity(dades);//ExecuteHTTPPostRequestHttpResponseresponse=httpclient.execute(httppost);HttpEntityresEntity=response.getEntity(

安卓:上传照片

这个问题在这里已经有了答案:SendingimagesusingHttpPost(5个答案)关闭7年前。问候,我在从我的Android手机上传照片时遇到问题。这是我用来提示用户选择照片的代码:publicclassUploader{publicvoidupload(){Log.i("EOH","hi...");IntentphotoPickerIntent=newIntent(Intent.ACTION_GET_CONTENT);photoPickerIntent.setType("image/*");startActivityForResult(photoPickerIntent,1

php - 从android应用程序上传多个图像文件到php服务器

我是android编程的新手。我一直在尝试使用以下代码将多张图片从我的应用程序上传到服务器。这里image[]数组与名称值对中的其他数据(如用户名、密码等)一起发布到服务器。Java代码:publicvoidpost(Stringurl,ListnameValuePairs){HttpClienthttpClient=newDefaultHttpClient();HttpPosthttpPost=newHttpPost(url);try{MultipartEntityentity=newMultipartEntity(HttpMultipartMode.BROWSER_COMPATIB

带有 php 文件登录详细信息的 Android POST 数据 - https

我目前正在尝试通过Android将数据发布到我的网站。我要向其发送数据的php脚本需要登录...通过浏览器,我可以使用如下链接中的登录数据:https://demo:demo@www.example.com/foo.php?bar=42如果我用下面的代码尝试同样的操作,什么都不会发生:publicvoidpostData(){//CreateanewHttpClientandPostHeaderHttpClienthttpclient=newDefaultHttpClient();StringpostUrl="https://demo:demo@www.example.com/foo.

android - 如何通过 UTF-8 中的 http post 发送字符串

我尝试发送字符串“Приветмир!”Stringlink=POST_URL;HttpClienthttpclient=newDefaultHttpClient();HttpPosthttppost=newHttpPost(link);Stringxml="Приветмир";ListnameValuePairs=newArrayList();nameValuePairs.add(newBasicNameValuePair("file",xml));httppost.setEntity(newUrlEncodedFormEntity(nameValuePairs));HttpRes

java - MultipartEntityBuilder 将图片发送到铁路服务器

我正在尝试将MultipartEntityBuilder发送到我的Rails服务器。然而,当我尝试构建它时,它崩溃并给我错误03-2509:44:50.001W/System.err﹕java.util.concurrent.ExecutionException:java.lang.NoSuchMethodError:Nostaticmethodcreate(Ljava/lang/String;[Lorg/apache/http/NameValuePair;)Lorg/apache/http/entity/ContentType;inclassLorg/apache/http/enti

java - Android HTTP POST 请求错误 - 套接字失败 EACCES(权限被拒绝)

我正在尝试从Eclipse下的Android应用向我的本地主机发送POST请求,但我收到此错误:socketfailedEACCES(Permissiondenied).我正在通过apache.commons库执行此操作。我之前尝试过通过HttpClient连接,但是出现了类似的错误:Connecttomyhostrefused.代码如下:publicvoidonClick(Viewv){login=(EditText)findViewById(R.id.entry_login);userLogin=login.getText().toString();pwd=(EditText)fi

java - 以编程方式从 WebView 登录

在我的Android应用程序中,我使用WebView访问服务器提供的一些网络map数据。服务器需要一些基于HTTP表单的身份验证以允许访问这些数据。由于该网站没有移动版本,显示登录页面(或任何其他页面)看起来很糟糕。不幸的是,我无法访问该站点,因此我想到了以下方法:使用native用户界面收集用户名和密码认为一个Httppost将这些信息发送到服务器收到响应后获取服务器发送的cookie将cookie设置为WebView尝试最终访问所需的数据现在我只是想通过登录阶段。这是一个可行的解决方案,还是完全错误,我应该尝试其他方法?为了完整起见,我在下面发布了代码一个。认证部分privateS