验证谷歌在Android中放置自动完成输入

时间:2016-12-11 22:04:31

标签: android listview autocomplete google-places-api

我们如何检测用户是否从建议列表中选择了地址,并且未使用Google Places API在自动填充文字视图中接受其他条目,例如“kjkshkjjhd”?

AutoCompleteTextView places = (AutoCompleteTextView) findViewById(R.id.autocomplete);
    places.setAdapter(new PlacesAutoCompleteAdapter(this,android.R.layout.simple_dropdown_item_1line ));
    places.setOnItemClickListener(this);

 @Override
public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
    // TODO Auto-generated method stub
    String str = (String) adapterView.getItemAtPosition(position);
    Toast.makeText(this, str, Toast.LENGTH_SHORT).show();
}

0 个答案:

没有答案