Java Google在AutoCompleteTextView Android Studio中放置API
我正在尝试实现AutocompleteTextView,但没有找到任何解决方案 我在片段中找到了GooglePlaceAPI的解决方案,但我需要在textview中找到它Java Google在AutoCompleteTextView Android Studio中放置API,java,android,Java,Android,我正在尝试实现AutocompleteTextView,但没有找到任何解决方案 我在片段中找到了GooglePlaceAPI的解决方案,但我需要在textview中找到它 public class PlaceArrayAdapter extends ArrayAdapter<PlaceArrayAdapter.PlaceAutocomplete> implements Filterable { private static final String TAG
public class PlaceArrayAdapter
extends ArrayAdapter<PlaceArrayAdapter.PlaceAutocomplete> implements Filterable {
private static final String TAG = "PlaceArrayAdapter";
private GoogleApiClient mGoogleApiClient;
private AutocompleteFilter mPlaceFilter;
private LatLngBounds mBounds;
private ArrayList<PlaceAutocomplete> mResultList;
/**
* Constructor
*
* @param context Context
* @param resource Layout resource
* @param bounds Used to specify the search bounds
* @param filter Used to specify place types
*/
public PlaceArrayAdapter(Context context, int resource, LatLngBounds bounds,
AutocompleteFilter filter) {
super(context, resource);
mBounds = bounds;
mPlaceFilter = filter;
}
public void setGoogleApiClient(GoogleApiClient googleApiClient) {
if (googleApiClient == null || !googleApiClient.isConnected()) {
mGoogleApiClient = null;
} else {
mGoogleApiClient = googleApiClient;
}
}
@Override
public int getCount() {
return mResultList.size();
}
}
}
}
公共类PlaceArrayAdapter
扩展ArrayAdapter实现可筛选{
私有静态最终字符串TAG=“PlaceArrayAdapter”;
私人GoogleapClient MGoogleapClient;
专用自动完成过滤器;
私人LatLngBounds mBounds;
私有ArrayList mResultList;
/**
*建造师
*
*@param上下文
*@param资源布局资源
*@param bounds用于指定搜索边界
*@param筛选器用于指定位置类型
*/
public PlaceArrayAdapter(上下文、int资源、LatLngBounds边界、,
自动完成过滤器(过滤器){
超级(上下文、资源);
mBounds=边界;
mPlaceFilter=过滤器;
}
公共无效设置GoogleAppClient(GoogleAppClient GoogleAppClient){
if(googleApiClient==null | |!googleApiClient.isConnected()){
mgoogleapclient=null;
}否则{
mGoogleApiClient=googleApiClient;
}
}
@凌驾
public int getCount(){
返回mResultList.size();
}
}
}
}
您的用例是什么?您是否需要在EditText中输入搜索查询并以自定义方式显示结果,而不是使用Maps API提供的默认方式?是@Ruthwik Warrier您的用例是什么?您是否需要在EditText中输入搜索查询并以自定义方式显示结果,而不是使用Maps API提供的默认方式?Yes@Ruthwik Warrier