首页 > 代码库 > 高德地图关键字搜索
高德地图关键字搜索
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 } });
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。