Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding a bitmap to the drawable resources

How can I add a Bitmap taken from the web (in the app i mean!) to the drawable resources? So i can access the Bitmap using R.drawable.bitmapName...

like image 451
Abramodj Avatar asked Dec 29 '10 15:12

Abramodj


People also ask

How do you insert a picture into a drawable resource?

Step 1: In this method first of all in your system find your required images and copy the image as we do normally. Step 2: Then open the Android Studio go to the app > res > drawable > right-click > Paste as shown in the below figure.

How do I create a bitmap from resources?

To create a bitmap from a resource, you use the BitmapFactory method decodeResource(): Bitmap bitmap = BitmapFactory. decodeResource(getResources(), R. drawable.

What is a bitmap drawable?

android.graphics.drawable.BitmapDrawable. A Drawable that wraps a bitmap and can be tiled, stretched, or aligned. You can create a BitmapDrawable from a file path, an input stream, through XML inflation, or from a Bitmap object. It can be defined in an XML file with the <bitmap> element.


1 Answers

You can't modify that folder once your app is installed. In that case, you must copy the bitmap to a file and access it from there. Take a look at this other question:

Save bitmap to location

like image 163
Cristian Avatar answered Oct 09 '22 03:10

Cristian