【发布时间】:2016-11-19 16:51:18
【问题描述】:
我正在设计一个使用地图并要求用户输入目的地的应用程序。我在 xml 中添加了 PlaceAutoCompleteFragment
分段 android:id="@+id/place_autocomplete_fragment" android:layout_width="200dp" android:layout_height="wrap_content" android:layout_gravity="top" android:name="com.google.android.gms.location.places.ui.PlaceAutocompleteFragment" />这就是我的 java 中的内容
PlaceAutocompleteFragment autocompleteFragment = (PlaceAutocompleteFragment)
getFragmentManager().findFragmentById(R.id.place_autocomplete_fragment);
autocompleteFragment.setOnPlaceSelectedListener(new PlaceSelectionListener() {
@Override
public void onPlaceSelected(Place place) {
// TODO: Get info about the selected place.
Log.i(TAG, "Place: " + place.getName());
}
@Override
public void onError(Status status) {
// TODO: Handle the error.
Log.i(TAG, "An error occurred: " + status);
}
});
当我尝试搜索时,它显示:“无法加载搜索结果”。之后我该怎么办?
【问题讨论】:
-
这对我来说是间歇性发生的。当它发生时很难修复。你找到解决办法了吗?
-
@Josh Smith 你找到解决方案了吗?
-
你找到解决办法了吗?
-
谁有这个解决方案?
标签: android google-maps autocomplete google-places-api