android - Get request error in resting framework -


i creating android client connects web service , gets response code. problem android app crashes whenever run following code:

 requestparams params = new basicrequestparams();   params.add("client_id", "24f8b46fc9db409012830ca264ad7bcf");  params.add("response_type", "code");   serviceresponse response=resting.get("http://pricewatch.ap01.aws.af.cm/api/pricewatch/oauth/auth",80,params);   icontentdata contentdata = response.getcontentdata();  string content = (string) contentdata.getcontent();   jsonobject jsonobject = new jsonobject(content);  string code = (string) jsonobject.get("code");  return code;        

it generates java.lang.nullpointerexception these line:

  icontentdata contentdata = response.getcontentdata(); 

could these? i've been stuck these. in advance!

i run code many times in emulator never worked. however, when run in android device worked! nullpointerexception happens when doesn't or response in server. don't understand why happen? there difference between emulator , android device in terms of executing android application?


Comments

Popular posts from this blog

c# - Operator '==' incompatible with operand types 'Guid' and 'Guid' using DynamicExpression.ParseLambda<T, bool> -