我用GeoFirestore
找到最近的位置,它工作,但我需要加载我进入的文件RecyclerView
,怎么可能做到这一点?
GeoFirestore 方法
private void getNearestEstate(){
GeoQuery geoQuery = geoFirestore.queryAtLocation(new GeoPoint(latitude, longitude), 2);
geoQuery.addGeoQueryDataEventListener(new GeoQueryDataEventListener() {
@Override
public void onDocumentEntered(DocumentSnapshot documentSnapshot, GeoPoint geoPoint) {
}
}
加载到 Rv
private void dataFetch(Query query,int rvView){
FirestoreRecyclerOptions<Property> options = new FirestoreRecyclerOptions.Builder<Property>()
.setQuery(query, Property.class)
.build();
Toast.makeText(getContext(),options.toString(),Toast.LENGTH_LONG).show();
mAdapter = new DiscoverAdapter(options);
RecyclerView recyclerView = root.findViewById(rvView);
recyclerView.setHasFixedSize(true);
recyclerView.setLayoutManager(new LinearLayoutManager(getContext(),LinearLayoutManager.HORIZONTAL,false));
recyclerView.setAdapter(mAdapter);
mAdapter.startListening();
}