Skip to content Skip to sidebar Skip to footer

Bitmapfactory.decoderesource Does Not Recognise Drawables

I'm trying to load a simple image as a background for a GPS app using C# in Visual Studio. The resources are located in Resources/drawable/resource file Now I've been trying to d

Solution 1:

Resourcesres= getContext().getResources();
intid= R.drawable.image; 
Bitmapb= BitmapFactory.decodeResource(res, id);

This shall return the decoded Bitmap or it will return null if the image cannot be decoded.

NOTE : The Bitmap would be different if "image" exists in all drawable folders(like ldpi,mdpi,hdpi , etc) . So it's ideal to keep the image in the original drawable folder unaltered.

Post a Comment for "Bitmapfactory.decoderesource Does Not Recognise Drawables"