CursorAdapter for GoogleMaps Activities

I wonder if there is any work on adapter implementation, for example. A CursorAdapter that can place markers in a GoogleMap hosted in an Activity or FragmentActivity. The adapter class definition specifies:

The Adapter object acts as a bridge between the AdapterView and the underlying data for this view. The adapter provides access to items data. The adapter is also responsible for creating a view for each item in the dataset.

If you interpret Marker as a View on top of the map layer, the Adapter would be suitable for connecting the lining data displayed on the map.

The problem is that the general CursorAdapter pattern in my example does not apply to the map case:

public void bindView(View view, Context context, Cursor cursor) { // Retrieve data from the cursor // Update the view holder with actual values } public View newView(Context context, Cursor cursor, ViewGroup parent) { // Inflate XML layout for a list item // Prepare view holder } 

To work with this template, the marker must be equivalent to a list box. Although, the marker is not overpriced. The main template is the following and does not match the adapter:

 GoogleMap mMap; // Prepare marker options from cursor data mMap.addmarker(markerOptions); 

How would you create such an adapter class? You can post and discuss pseudocode.

+6
source share

Source: https://habr.com/ru/post/948103/


All Articles