Android Volley gives me 400 error
本文来自:http://stackoverflow.com/questions/21739276/android-volley-gives-me-400-error
本人是根据文中的其中一方法:
I had the same problem and i removed from the header:
headers.put("Content-Type", "application/json");
now it works great!
以下是全文
|
I'm trying to make a
I get the following error:
I have seen a lot of examples and I don't really see what is going wrong here. Anyone any idea? I updated the code with this method:
and changed
Still getting the same error! |
|||||||||||||||||||||
|
|
I had the same problem and i removed from the header:
now it works great!
|
|||||
|


|
400 indicates a bad request, maybe you're missing |
|||||||||||||||||||||
|
|
I've got this error and now Iit's been fixed. I did what is told in this link. What you need to do is
with
Hope this helps. |
||||
|
I have removed this params.put("Content-Type", "application/x-www-form-urlencoded"); This is my Code Change.
|
|||
|
I have the same issue before and I got the solution in my project:
In the code Snippet above I used Post Method: My answer is base on my experience and so take note: 1.) When using POST method use "StringRequest" instead of "JsonObjectRequest" 2.) inside getHeaders Override the value with an Empty HashMap
And everything works in my case. |
|||
|
In Android 2.3 there is a problem using Base64.encodeToString() as it introduces a new line in HTTP header. See my response to this question here in SO. Short answer: Don't use Base64.encodeToString() but put the already encoded String there. |
||||
|
400 error is because Content-Type is set wrong. Please do the following.
|
|||
|
There can be multiple reasons for this error. One ofcouse as said by others is, maybe you are missing or have improperly set 'Content-type' header. If you are properly implemented that, other possible reason is that you are sending params directly from your url. There may be a case when params is a string with some white spaces in it. These white spaces cause problem in GET requests through volley. You need to find another way around it. Thats all. |
|||||||||
|
Android Volley gives me 400 error的更多相关文章
- Android Volley彻底解决(三),定制自己Request
转载请注明出处:http://blog.csdn.net/guolin_blog/article/details/17612763 经过前面两篇文章的学习,我们已经掌握了Volley各种Request ...
- [Android]Volley的使用
Volley是Google I/O 2013上提出来的为Android提供简单快速网络访问的项目.Volley特别适合数据量不大但是通信频繁的场景. 优势 相比其他网络载入类库,Volley 的优势官 ...
- [转] Android Volley完全解析(一),初识Volley的基本用法
版权声明:本文出自郭霖的博客,转载必须注明出处. 目录(?)[-] Volley简介 下载Volley StringRequest的用法 JsonRequest的用法 转载请注明出处:http ...
- Android Volley入门到精通:定制自己的Request
经过前面两篇文章的学习,我们已经掌握了Volley各种Request的使用方法,包括StringRequest.JsonRequest.ImageRequest等.其中StringRequest用于请 ...
- Android Volley入门到精通:使用Volley加载网络图片
在上一篇文章中,我们了解了Volley到底是什么,以及它的基本用法.本篇文章中我们即将学习关于Volley更加高级的用法,如何你还没有看过我的上一篇文章的话,建议先去阅读Android Volley完 ...
- Android Volley入门到精通:初识Volley的基本用法
1. Volley简介 我们平时在开发Android应用的时候不可避免地都需要用到网络技术,而多数情况下应用程序都会使用HTTP协议来发送和接收网络数据.Android系统中主要提供了两种方式来进行H ...
- Android Volley完全解析
1. Volley简介 我们平时在开发Android应用的时候不可避免地都需要用到网络技术,而多数情况下应用程序都会使用HTTP协议来发送和接收网络数据.Android系统中主要提供了两种方式来进行H ...
- Android Volley和Gson实现网络数据加载
Android Volley和Gson实现网络数据加载 先看接口 1 升级接口 http://s.meibeike.com/mcloud/ota/cloudService POST请求 参数列表如下 ...
- Android Volley源码分析
今天来顺手分析一下谷歌的volley http通信框架.首先从github上 下载volley的源码, 然后新建你自己的工程以后 选择import module 然后选择volley. 最后还需要更改 ...
随机推荐
- nginx 高并发配置参数(转载)
声明:原文章来自http://blog.csdn.net/oonets334/article/details/7528558.如需知道更详细内容请访问. 一.一般来说nginx 配置文件中对优化比较有 ...
- 使用Object类型的多态引用是会付出代价的
import java.util.*; public class FiveShi { String name; public void eat(){ System.out.println(" ...
- Ext JS 4 新特性2:配置项属性(config)之一
Ext JS 4 新特征2:配置项属性config 最新版本的Ext JS 4.2的另外一个伟大的新特征就是增加了configuration配置项属性,当我们在创建一个新类的时候,经常性的要设置某某属 ...
- Dynamic Programming
We began our study of algorithmic techniques with greedy algorithms, which in some sense form the mo ...
- 第七章 LED将为我闪烁:控制发光二极管
该Linux驱动用来控制开发板上的4个LED灯,即通过向Linux驱动发送数据可以控制LED灯的开关.LED驱动提供两种交互方式:命令和读写设备文件. 测试LED驱动之前需用USB线连接开发板,然后打 ...
- Hibernate 学习笔记一
Hibernate 学习笔记一 今天学习了hibernate的一点入门知识,主要是配置domain对象和表的关系映射,hibernate的一些常用的配置,以及对应的一个向数据库插入数据的小例子.期间碰 ...
- nodejs常用模块之url
统一资源定位符(url)充当http服务器用来处理来自客户端的请求的一个地址标签.它为把一个请求发到正确的服务器的特定端口上,并访问合适的数据提供了所有需要的信息.
- 基于css3的轮播效果
花了一上午来调整页面在ie10上的显示问题,sass编译生成的css文件在ie内核下一直不能正确加载,果然兼容性的问题还需要好好研究.转入正题,用css3实现轮播效果主要是基于css3的framewo ...
- Mysqli封装
<?php //headerheader('content-type:text/html;charset=UTF-8'); class DB { //定义属性 private $ho ...
- JDom2的Xpath使用
/** * XPath获取属性值 * @param root * @param xPath * @return */ public static String getXPathAttributeVal ...
android
