编辑框内容变化,修改列表

此时不会用到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) {

}
});

posted @ 2012-05-02 16:41  幻星宇  阅读(267)  评论(0编辑  收藏  举报