此时不会用到autocomplete编辑,而是为EditText添加addTextChangedListener事件
//搜索框
searchText.addTextChangedListener(new TextWatcher() { String urlStr = "r=game/getList&lang=" + APP_LANGUAGE; @Override public void onTextChanged(CharSequence s, int start, int before, int count) { serachKeyWord = searchText.getText().toString(); if( listFlag == "game" ){ urlStr = "r=game/getList&lang=" + APP_LANGUAGE + "&access_token=" + access_token + "&pid=" + pid; if( serachKeyWord != null || serachKeyWord.equals("") == false ){ urlStr = urlStr + "&keyword=" + serachKeyWord; } getGameListData(urlStr, httpPort); }else if( listFlag == "card" ){ urlStr = "r=card-category/getList&lang=" + APP_LANGUAGE + "&access_token=" + access_token + "&pid=" + pid; if( serachKeyWord != null || serachKeyWord.equals("") == false ){ urlStr = urlStr + "&keyword=" + serachKeyWord; } getCardListData(urlStr, httpPort); } } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void afterTextChanged(Editable s) { } });