Adding a bitmap to resources

How can I add a Bitmap taken from the Internet (in the application that I mean!) To resources that can be extracted? Therefore, I can access Bitmap using R.drawable.bitmapName ...

+4
source share
2 answers

You cannot change this folder after installing your application. In this case, you must copy the bitmap to a file and access it. Take a look at this other question:

Save bitmap in location

+6
source

Resources are compiled at the time of apk build, so you cannot change it at runtime. If you want to have some identifier, you might consider creating a general preference where you can link the uploaded image file with some id. But to implement this feature, you will need some effort.

+1
source

Source: https://habr.com/ru/post/1333689/


All Articles