Home » Android » android – get bitmap from bitmapdescriptor

android – get bitmap from bitmapdescriptor

Posted by: admin May 14, 2020 Leave a comment

Questions:

Is it possible to get a Bitmap from BitmapDescriptor?

I’m trying to use googles api’s to make my app more seemless but I could make custom Marker option objects instead… I would think that BitmapDescriptor would extend FileDescriptor but I don’t see that.

How to&Answers:

All the BitmapDescriptors come from the BitmapDescriptorFactory.

Example custom marker from imageId in MediaStore.

final BitmapFactory.Options bmOptions = new BitmapFactory.Options();
            bmOptions.inSampleSize = 8;  //about the size of standard marker

Bitmap bm = MediaStore.Images.Thumbnails.getThumbnail(
                            context.getContentResolver(), newImageId,
                            MediaStore.Images.Thumbnails.MINI_KIND,
                            bmOptions);
                    if (bm != null) {
                        BitmapDescriptor bd = BitmapDescriptorFactory
                                .fromBitmap(bm);
                        if (bd != null) {
                            markeroptions.icon(bd);