我正在尝试学习如何使用AutocompleteSupportFragment
,但是我发现PlaceSelectionListener
仅具有onPlaceSelected
和onError
方法,但没有提供找不到位置时调用。
我该如何收听no result found
?
下面是我的代码
if ( !Places.isInitialized() ) {
Places.initialize( getApplicationContext(), getString( R.string.GOOGLE_MAPS_API_KEY ) );
autoCompleteFragment = (AutocompleteSupportFragment) getSupportFragmentManager()
.findFragmentById( R.id.autoCompleteFragment );
autoCompleteFragment.setHint( getString( R.string.search_address_hint ) );
autoCompleteFragment.setPlaceFields( Arrays.asList( Place.Field.ID,
Place.Field.NAME, Place.Field.ADDRESS, Place.Field.LAT_LNG ) );
autoCompleteFragment.setCountry( "ZM" );
btnConfirm.setOnClickListener( v -> confirmAddress() );
autoCompleteFragment.setOnPlaceSelectedListener( new PlaceSelectionListener() {
@Override
public void onPlaceSelected(Place place) {
edtBuilding.setText( place.getName() );
startIntentService( place.getLatLng() );
adjustCamera( place.getLatLng() );
mPresenter.addMarker( place.getLatLng(), place.getName(), place.getAddress(), ConfirmPickUpActivity.MARKER_NORMAL );
}
@Override
public void onError(Status status) {
Log.i( TAG, "An error occurred: " + status );
}
} );
}
答案 0 :(得分:0)
它在那里,状态码Widget _buildList(BuildContext context, List<DocumentSnapshot> snapshot) {
return Column(
children:[
Expanded(
child:
ListView(
padding: const EdgeInsets.only(top: 10.0),
children: snapshot.map((data) => _buildListItem(context, data)).toList(),
),),
RaisedButton(
// fill in required params
)
]
}
。在您的代码中,您必须编写。
NOT_FOUND