-3

I am passing values from Activity A to Activity B and storing the values in EditText since I need it to be editable The purpose is to provide editable option, once any update done is updated to database, When i edit the text in edit text box by entering few characters it accepts and application runs but when i insert space between the text eg: name[space]initial then run the application crashes.

I saw the log and it says illegal argument , I don know whats causing the problem ..

the values from previous activity are retrieved here rname=getIntent().getExtras().getString("NAME"); remail=getIntent().getExtras().getString("EMAIL"); rphone=getIntent().getExtras().getString("PHONE NO"); raddress=getIntent().getExtras().getString("ADDRESS"); rcity=getIntent().getExtras().getString("CITY"); rcityloc=getIntent().getExtras().getString("CITYLOCATION"); rqual=getIntent().getExtras().getString("QUALIFICATION"); rgender=getIntent().getExtras().getString("GENDER");

the above received values are being stored in edit text boxes as below 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.the editing if present is done and is sent to server with the below code edit text values are converted to string and then sent to server

    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 );
  1. the log output

FATAL EXCEPTION : main
java.lang.IllegalArgumentException: Illegal charecter in query at
and displays
the post method url mentioned above in 3

4

1 回答 1

0

如果我以正确的方式理解所有这些内容,您将尝试使用 editText 条目和 HttpPost 做一些事情。我认为在这个 HttpPost 之间添加空格会使应用程序崩溃,因为不允许使用空格。尝试用 %20 替换所有空格

于 2013-07-30T15:55:37.593 回答