i want to request wfc service by using url and i add three parameter in url it was error in run time illegal argument exception
String myUrl;
myUrl = String.format("http://10.0.2.2:51382/RestServiceImpl.svc/jsons/? Location=%s&GROUP=%s&asondate=%s",items,items1,finalDate);
logcat
07-03 10:04:31.602: E/AndroidRuntime(2790): java.lang.RuntimeException: Unable to start activity
ComponentInfo{com.androidhive.innovate/com.androidhive.innovate.AndroidJSONParsingActivity}: java.lang.IllegalArgumentException: Illegal character in query at index 49: http://10.0.2.2:51382/RestServiceImpl.svc/jsons/? Location=ArihantWanarpet&GROUP=ArihantShowroom&asondate=2013-07-03
最佳答案
您的 URL 中 ?
之后有一个空格。摆脱它,我想你会没事的,一切都会好起来的。所以这个:
"http://10.0.2.2:51382/RestServiceImpl.svc/jsons/? Location=%s&GROUP=%s&asondate=%s"
成为
"http://10.0.2.2:51382/RestServiceImpl.svc/jsons/?Location=%s&GROUP=%s&asondate=%s"
关于java - url 中的非法参数异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17447285/