I'm trying to call a json webservice continuously when there is a letter is added or deleted in a Autocomplete textview. Everything untill here works fine here. But when I try to select an option from the list generated by the autocomplete textview, now the Json is again called and the App Crashes. (ie) The value selected in the autocomplete is again passed to json get method as a parameter and the app is crashed. Can anyone help me resolving this issue.
companyName_autoComplete = (AutoCompleteTextView) findViewById(R.id.companyName_autoComplete);
selectIndustry_button.addTextChangedListener(new TextWatcher() {
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
// TODO Auto-generated method stub
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count,
int after) {
// TODO Auto-generated method stub
}
@Override
public void afterTextChanged(Editable s) {
// TODO Auto-generated method stub
SearchCPS_WS();
}
});
private void SearchCPS_WS() {
AsyncHttpClient client = new AsyncHttpClient();
RequestParams params = new RequestParams();
Log.i("WebService", "WebService: "+Httppost_Links.SEARCH_COMPANY_NAME_ADD_COMPANY+textInAutoComplete+"5@0");
client.get(Httppost_Links.SEARCH_COMPANY_NAME_ADD_COMPANY+textInAutoComplete+"/5@0", params,
new AsyncHttpResponseHandler() {
@Override
public void onSuccess(String response) {
// TODO Auto-generated method stub
Log.i("SearchCPS_WS response: ",
"SearchCPS_WS response: " + response);
}
Here's my stack:
05-06 08:34:11.002: E/AndroidRuntime(5451): FATAL EXCEPTION: main
05-06 08:34:11.002: E/AndroidRuntime(5451): Process: com.bvibes, PID: 5451
05-06 08:34:11.002: E/AndroidRuntime(5451): java.lang.IllegalArgumentException: Illegal character in path at index 78: http://beta.teambv.us/mobile/services/json/SearchCompanyNameList.json/Fountain Powerboat Industries, Inc./5@0?
05-06 08:34:11.002: E/AndroidRuntime(5451): at java.net.URI.create(URI.java:727)
05-06 08:34:11.002: E/AndroidRuntime(5451): at org.apache.http.client.methods.HttpGet.<init>(HttpGet.java:75)
05-06 08:34:11.002: E/AndroidRuntime(5451): at com.loopj.android.http.AsyncHttpClient.get(AsyncHttpClient.java:338)
05-06 08:34:11.002: E/AndroidRuntime(5451): at com.loopj.android.http.AsyncHttpClient.get(AsyncHttpClient.java:317)
05-06 08:34:11.002: E/AndroidRuntime(5451): at com.bvibes.Profile_Activity.SearchCPS_WS(Profile_Activity.java:156)
05-06 08:34:11.002: E/AndroidRuntime(5451): at com.bvibes.Profile_Activity.access$0(Profile_Activity.java:147)
05-06 08:34:11.002: E/AndroidRuntime(5451): at com.bvibes.Profile_Activity$3.afterTextChanged(Profile_Activity.java:128)
05-06 08:34:11.002: E/AndroidRuntime(5451): at android.widget.TextView.sendAfterTextChanged(TextView.java:7424)
05-06 08:34:11.002: E/AndroidRuntime(5451): at android.widget.TextView.setText(TextView.java:3822)
05-06 08:34:11.002: E/AndroidRuntime(5451): at android.widget.TextView.setText(TextView.java:3671)
05-06 08:34:11.002: E/AndroidRuntime(5451): at android.widget.EditText.setText(EditText.java:80)
05-06 08:34:11.002: E/AndroidRuntime(5451): at android.widget.TextView.setText(TextView.java:3646)
05-06 08:34:11.002: E/AndroidRuntime(5451): at android.widget.AutoCompleteTextView.replaceText(AutoCompleteTextView.java:945)
05-06 08:34:11.002: E/AndroidRuntime(5451): at android.widget.AutoCompleteTextView.performCompletion(AutoCompleteTextView.java:891)
05-06 08:34:11.002: E/AndroidRuntime(5451): at android.widget.AutoCompleteTextView.access$500(AutoCompleteTextView.java:91)
05-06 08:34:11.002: E/AndroidRuntime(5451): at android.widget.AutoCompleteTextView$DropDownItemClickListener.onItemClick(AutoCompleteTextView.java:1192)
05-06 08:34:11.002: E/AndroidRuntime(5451): at android.widget.AdapterView.performItemClick(AdapterView.java:299)
05-06 08:34:11.002: E/AndroidRuntime(5451): at android.widget.AbsListView.performItemClick(AbsListView.java:1113)
05-06 08:34:11.002: E/AndroidRuntime(5451): at android.widget.AbsListView$PerformClick.run(AbsListView.java:2904)
05-06 08:34:11.002: E/AndroidRuntime(5451): at android.widget.AbsListView$3.run(AbsListView.java:3638)
05-06 08:34:11.002: E/AndroidRuntime(5451): at android.os.Handler.handleCallback(Handler.java:733)
05-06 08:34:11.002: E/AndroidRuntime(5451): at android.os.Handler.dispatchMessage(Handler.java:95)
05-06 08:34:11.002: E/AndroidRuntime(5451): at android.os.Looper.loop(Looper.java:136)
05-06 08:34:11.002: E/AndroidRuntime(5451): at android.app.ActivityThread.main(ActivityThread.java:5017)
05-06 08:34:11.002: E/AndroidRuntime(5451): at java.lang.reflect.Method.invokeNative(Native Method)
05-06 08:34:11.002: E/AndroidRuntime(5451): at java.lang.reflect.Method.invoke(Method.java:515)
05-06 08:34:11.002: E/AndroidRuntime(5451): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
05-06 08:34:11.002: E/AndroidRuntime(5451): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
05-06 08:34:11.002: E/AndroidRuntime(5451): at dalvik.system.NativeStart.main(Native Method)