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. 最后还需要更改 ...
随机推荐
- 记第一次TopCoder, 练习SRM 583 div2 250
今天第一次做topcoder,没有比赛,所以找的最新一期的SRM练习,做了第一道题. 题目大意是说 给一个数字字符串,任意交换两位,使数字变为最小,不能有前导0. 看到题目以后,先想到的找规律,发现要 ...
- vs13的内存占用 关闭之
.如何关闭CodeLens呢? 在VS菜单栏 >> 工具 >> 选项 >> 文本编辑器 >> 所有语言 >> CodeLens In VS ...
- CGContext 解释
Managing Graphics Contexts:管理图形上下文 CGContextFlush // 强制立即渲染未执行在一个窗口上下文上的绘图操作到目标设备.系统会在合适的时机自动调用此函数,手 ...
- linux 两个文件合并
可以使用cat命令,有两种实现的方式,一种将两个文件合并的到一个新的文件,另一种将一个文件追加到另一个文件的末尾. 方法一:使用cat命令从文件中读入两个文件,然后将重定向到一个新的文件.这种方法可以 ...
- How to address this problem?
root# cmake .. No problem. root# make [ 63%] Linking CXX shared module collisionperceptor.so/usr/bin ...
- C++引用的作用和用法
引用就是某一变量(目标)的一个别名,对引用的操作与对变量直接操作完全一样. 引用的声明方法:类型标识符&引用名=目标变量名: 例如: int q; int &ra=a; 说明: &am ...
- .net dataGridView当鼠标经过时当前行背景色变色;然后【给GridView增加单击行事件,并获取单击行的数据填充到页面中的控件中】
1.首先在前台dataGridview属性中增加onRowDataBound属性事件 2.然后在后台Observing_RowDataBound事件中增加代码 protected void Obser ...
- 利用border-radious画图形
今天才发现,border-radius可以画很多图形,下面跟我来看一下吧: 在设有宽和高的情况下画一个圆: #div1{ /*宽高相等,圆角范围为高或宽的一半或以上*/ background-colo ...
- MVC3之ViewData与ViewBag
首先先用代码来说话: ViewData: public ActionResult Index() { List<string> colors = new List<string> ...
- Ubuntu 64位下搭建ADT的种种问题
我使用的adt版本为 adt-bundle-linux-x86_64-20140702.zip 1. Eclipse启动时提示 adb 无法加载动态链接库 libstdc++.so.6 以及 lib ...