Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Saving to drawable folder programmatically in Android

I'm looking to have a user select an image from the gallery, and have this file saved as a permanent drawable resource when they open the app at a later time. Is this possible?

I mean as an object in the actual drawable folder.

like image 220
Bisclavret Avatar asked Jul 11 '15 02:07

Bisclavret


People also ask

How do I save a bitmap image to drawable android?

This example demonstrates how do I convert Bitmap to drawable in android. Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project. Step 2 − Add the following code to res/layout/activity_main. xml.

How to put image in drawable XML file?

To use an image resource, add your file to the res/drawable/ directory of your project. Once in your project, you can reference the image resource from your code or your XML layout. Either way, it's referred to using a resource ID, which is the file name without the file type extension. For example, refer to my_image.

How to add image in drawable folder in Android Studio?

To import image resources into your project, do the following: Drag and drop your images directly onto the Resource Manager window in Android Studio. Alternatively, you can click the plus icon (+), choose Import Drawables, as shown in figure 3, and then select the files and folders that you want to import.

What is drawable folder in android directory?

In Android Studio inside the res folder, one can find the drawable folder, layout folder, mipmap folder, values folder, etc. Among them, the drawable folder contains the different types of images used for the development of the application.


1 Answers

No, it's not possible. "The drawable folder" doesn't exist as a file system folder at runtime - it's part of your (read-only) binary .apk file.

like image 139
GreyBeardedGeek Avatar answered Nov 04 '22 02:11

GreyBeardedGeek