Any relation method between org.mapsforge.core.graphics.Bitmap and android.graphics.Bitmap

695 views Asked by At

I am new to mapforge and want to display my custom marker(read it from sdcard) and display on mapforge offline map.problem i am facing is dont know how to convert my android.graphics.Bitmap obj to org.mapsforge.core.graphics.Bitmap obj

Bitmap userImg = TrafficBeatHelper.getUserImg(context, userId); // get android.graphics.Bitmap file from sdcard
LatLong userLatLong = TrafficBeatHelper.getLatLong(cache.getSharedPrefValue(SharedPrefContstant.USER_CURRENT_LATITUDE),cache.getSharedPrefValue(SharedPrefContstant.USER_CURRENT_LONGITUDE)); // get user location
//  Marker userImgMarker = new Marker(userLatLong, userImg, 0, 0);

any one have any other alternative than please share txs in advance.

1

There are 1 answers

1
Harsh Darji On BEST ANSWER

After 1 day googling i found that there is no relation between android.graphics.Bitmap and org.mapsforge.core.graphics.Bitmap. We can use another approach rather than converting image into bitmap we can use Drawable object and from that we can make org.mapsforge.core.graphics.Bitmap and android.graphics.Bitmap objects.

org.mapsforge.core.graphics.Bitmap bitmap = AndroidGraphicFactory.convertToBitmap(drawable);

and

android.graphics.Bitmap bitmap = ((BitmapDrawable)d).getBitmap();