Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

Can't seem to add Markers #8704

Closed
Closed

Description

@galacticappster04

I am using this following code:

private void createMarker(final Recommendation recommendation)
{
if(!isVisible())
return;

    mPinBitmapUtils.retrievePinBitmapAsync(getContext(), recommendation, new OnPinBitmapProcessed()
    {
        @Override
        public void onBitmapProcess(final Pin reco, PinType pinType, Map<String, String> directories)
        {
            if(!isVisible())
                return;

            recommendation.setName(pinType.getName());

            new AsyncTask<String, Void, PinMarkerOptions>()
            {
                @Override
                protected PinMarkerOptions doInBackground(String... strings)
                {
                    IconFactory iconFactory = IconFactory.getInstance(getContext());

                    Bitmap bitmap = Utils.getBitmapFromFile(getContext()
                            , new File(strings[0])
                            , (int) Utils.convertDpToPixel(48, getContext())
                            , (int) Utils.convertDpToPixel(48, getContext()));

                    Icon icon = iconFactory.fromBitmap(bitmap);

                    LatLng position = new LatLng();
                    position.setLatitude(recommendation.getLatitude());
                    position.setLongitude(recommendation.getLongitude());

                    PinMarkerOptions markerOption = new PinMarkerOptions();
                    markerOption.setPosition(position);
                    markerOption.setMetaData(recommendation.getJSON().toString());

                    if(icon != null)
                        markerOption.setIcon(icon);

                    return markerOption;
                }

                @Override
                public void onPostExecute(PinMarkerOptions marker)
                {
                   mMapboxMap.addMarker(marker);
                }

            }.execute(directories.get(Constants.BLUE_PIN));
        }
    });
}

When I checked the MapBox map instance, it does indeed increased in size but the pin I created is no where in sight.

I am still using 4.2.2 and in the process to migrating to 5.0.2 so I haven't check it on the latest version entirely.

Anything so basic I missed out on?

Activity

  1. galacticappster04 commented on Apr 11, 2017

    @galacticappster04
    Author

    Alright, it seems if I delete a bunch of Markers, and I re-add them back again, this happens. MapBox map sizes increases and but no markers were shown.

  2. galacticappster04 commented on Apr 11, 2017

    @galacticappster04
    Author

    Can someone please help? It doesn't seem to work, I cannot add Markers unless I restarted the whole map. Anyway I can get around this? Markers are not showing when I remove them (due to filtering) and add them (when they go unfiltered). Calling addMarkers and addMarker doesn't seem to work. My map goes blank and that's it.

  3. jfirebaugh commented on Apr 11, 2017

    @jfirebaugh
    Contributor

    Hi, thanks for using Mapbox. For "how do I" questions like this, please refer to our help documentation, and if you can't find the answer there, contact support. This issue tracker is for reporting bugs and feature requests. Thank you!

  4. galacticappster04 commented on Apr 12, 2017

    @galacticappster04
    Author

    @jfirebaugh. This is not a "how question". I am saying addMarker doesn't show the marker I added. It appears you didn't read my concern.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions