EditText startTextView=(EditText) findViewById(R.id.car_search_et);
startTextView.addTextChangedListener(new TextWatcher() {
@Override
public void onTextChanged(CharSequence s, int start, int count,
int after) {
String newText = s.toString().trim();
Inputtips inputTips = new Inputtips(SearchCity.this,
new InputtipsListener() {
@Override
public void onGetInputtips(List<Tip> tipList, int rCode) {
if (rCode == 0) {// 正确返回
citylist = new ArrayList<Map<String, String>>();
for (int i = 0; i < tipList.size(); i++) {
Map<String, String> map=new HashMap<String, String>();
//city.setName(tipList.get(i).getName()+tipList.get(i).getDistrict());
map.put("adress", tipList.get(i).getName());
map.put("city", tipList.get(i).getDistrict());
citylist.add(map);
}
CityD aAdapter=new CityD(getApplicationContext(), citylist);
listView.setAdapter(aAdapter);
aAdapter.notifyDataSetChanged();
}
}
});
try {
inputTips.requestInputtips(newText, startTextView.getText().toString());
} catch (com.amap.api.services.core.AMapException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
@Override
public void beforeTextChanged(CharSequence arg0, int arg1, int arg2,
int arg3) {
// TODO Auto-generated method stub
}
@Override
public void afterTextChanged(Editable arg0) {
// TODO Auto-generated method stub
}
});
高德地图关键字搜索
最新推荐文章于 2023-09-18 15:29:39 发布