0

RequestParams have put Object method,put(String key, Object value).

so I use the code below; On the server, the userId cann't find in get or post paramenters.

com.loopj.android.http.RequestParams params= new RequestParams ();
//添加参数 add params
params.put("userId", userId);  //Long userId;
params.put("nickname", nickname);//String
morten.c
  • 3,414
  • 5
  • 40
  • 45
wei-song
  • 17
  • 5

1 Answers1

0

try using params.put("userId", Long.toString(userId));

if you look at the source code of the library, you will see that method put(String key,Object value) adds param with non-string value (e.g. Map, List, Set). you will also find some recently added methods which accept long or int as value, but if you are using the library jar file, version 1.4.4, you will notice that you haven't those new methods thus you can use put(String,String) to get it work

medhdj
  • 1,168
  • 10
  • 17
  • And description as to why this will make it work? What's the current problem with OP's code? – Jerry Apr 22 '14 at 11:06