我将值从活动A传递到活动B并将值存储在EditText中,因为我需要它可编辑目的是提供可编辑选项,一旦任何更新完成更新到数据库,当我在编辑文本框中编辑文本时输入它接受的几个字符和应用程序运行但是当我在文本之间插入空格例如:name [space] initial然后运行应用程序崩溃 .
我看到了日志,它说非法论证,我不知道是什么导致了这个问题 .
此处检索先前活动的值rname = getIntent() . getExtras() . getString(“NAME”); remail = getIntent()getExtras()的getString( “电子邮件”) . ; rphone = getIntent() . getExtras() . getString(“PHONE NO”); raddress = getIntent()getExtras()的getString( “ADDRESS”) . . rcity = getIntent()getExtras()的getString( “城市”) . . rcityloc = getIntent()getExtras()的getString( “CITYLOCATION”) . . rqual = getIntent()getExtras()的getString( “资格”) . ; rgender = getIntent()getExtras()的getString( “性别”) . ;
以上接收的值存储在编辑文本框中,如下所示ename =(EditText)findViewById(R.id.namebox); ename.setText(RNAME,TextView.BufferType.EDITABLE);
eemail =(的EditText)findViewById(R.id.emailbox); eemail.setText(remail,TextView.BufferType.NORMAL);
ephone=(EditText)findViewById(R.id.phonebox);
ephone.setText(rphone,TextView.BufferType.EDITABLE);
eaddress=(EditText)findViewById(R.id.addressbox);
eaddress.setText(raddress,TextView.BufferType.EDITABLE);
ecity=(EditText)findViewById(R.id.citybox);
ecity.setText(rcity,TextView.BufferType.EDITABLE);
ecityloc=(EditText)findViewById(R.id.citylocbox);
ecityloc.setText(rcityloc,TextView.BufferType.EDITABLE);
equal=(EditText)findViewById(R.id.qualbox);
equal.setText(rqual,TextView.BufferType.EDITABLE);
egender=(EditText)findViewById(R.id.genderbox);
gender.setText(rgender,TextView.BufferType.EDITABLE);
3.编辑如果存在并发送到服务器,下面的代码编辑文本值将转换为字符串然后发送到服务器
HttpPost httppost = new HttpPost(UrlPath.Upath+"User_profile_update?sid=" + sid + "&name=" +sname+ "&phone=" + sphone + "&address=" + saddress + "&city=" + scity + "&city_location=" + scityloc + "&qualification=" +squal + "&gender=" +sgender );
- 日志输出
FATAL EXCEPTION:main java.lang.IllegalArgumentException:查询中的非法字符,并在3中显示上面提到的post方法url
1 回答
如果我以正确的方式理解所有这些东西,你试图用editText条目和HttpPost做一些事情 . 我认为在这个HttpPost之间添加空格会使应用程序崩溃,因为不允许使用空格 . 尝试用%20替换所有空格