httpClient通过post上传数据
来源:互联网 发布:淘宝主图多大尺寸最好 编辑:程序博客网 时间:2024/05/22 04:56
@Override protected Boolean doInBackground(String... params) { Boolean result=false; HttpClient client = new DefaultHttpClient(); HttpPost post = new HttpPost(params[0]); Map<String, String> map = new HashMap<String, String>();map.put("token", token);map.put(row, metupdate.getText().toString());List<NameValuePair> pairList = new ArrayList<NameValuePair>(map.size()); for (Map.Entry<String, String> entry : map.entrySet()) { NameValuePair pair = new BasicNameValuePair(entry.getKey(), entry.getValue()); pairList.add(pair); } try {HttpEntity requestHttpEntity = new UrlEncodedFormEntity(pairList,"UTF-8");post.setEntity(requestHttpEntity);} catch (UnsupportedEncodingException e1) {e1.printStackTrace();}try {HttpResponseresponse = client.execute(post);if(response.getStatusLine().getStatusCode()==200){String result1 = EntityUtils.toString(response.getEntity());JSONObject object1 = new JSONObject(result1);System.out.println("result1="+result1.toString());result = object1.getBoolean("success");if(result){String sql ="update user set "+row +"= '"+metupdate.getText().toString()+"' where uId="+appcation.getuId();db1.execSQL(sql);}}} catch (ClientProtocolException e) {e.printStackTrace();} catch (IOException e) {e.printStackTrace();} catch (JSONException e) {e.printStackTrace();} return result; }
0 0
- httpClient通过post上传数据
- HttpClient通过Post上传文件
- HttpClient 通过Post 上传文件。
- HttpClient通过Post上传文件
- HttpClient通过Post上传文件
- HttpClient通过Post上传文件
- HttpClient通过Post上传文件
- HttpClient通过Post上传文件
- HttpClient通过Post上传文件
- HttpClient通过Post方式发送Json数据
- HttpClient通过Post方式发送Json数据
- HttpClient通过Post方式发送Json数据
- HttpClient通过post上传文件和提交参数
- HttpClient通过post上传文件和提交参数
- HttpClient通过post上传文件和提交参数
- android通过 httpClient 的post访问 网络数据
- 通过HttpClient上传文件
- HttpClient --post请求数据
- .Net XML操作 <第二篇>
- Visual C# 下搭建DotSpatial开发环境
- HUD -- 3081 Marriage Match II(最大流+二分+并查集)
- 偷cocos的说明文件过来试试CSDN的markdown编辑器
- C#多线程(启动)
- httpClient通过post上传数据
- POJ 2893 M × N Puzzle(逆序对-BIT)
- bmp文件格式中rgb555与rgb888之间的转换,24位与16位位图的转换
- EF--Validation failed for one or more entities. See ‘EntityValidationErrors’解决方法
- 分解因数
- flash对话框制作和图层文件夹运用
- c++ primer读书笔记-第十三章 复制控制
- iOS多线程编程之NSThread使用
- 【问题】ScrollView截获按钮的点击事件?