Android Question Place a file into res/drawable folder

Starchild

Active Member
Licensed User
Longtime User
I want to use my own icon with the NOTIFY.
I need to place my own image file into res/drawable folder.
This folder is read only at runtime so I can not copy (from an asset file) into this folder.
How do I get my image file into the res/drawable folder on the device so I can referance it with NOTIFY.
 
Put your icon in the res/drawable folder (for ex. myicon.png), make it read only an then load it
Code: Copy
....       
        Dim AndroidResources1 As AndroidResources
        Dim Mydrawable1 As BitmapDrawable
        Mydrawable1=AndroidResources1.GetApplicationDrawable("myicon") 'without the file extension!
....
 
Upvote 0
Put your icon in the res/drawable folder (for ex. myicon.png), make it read only an then load it
Code: Copy
....    
        Dim AndroidResources1 As AndroidResources
        Dim Mydrawable1 As BitmapDrawable
        Mydrawable1=AndroidResources1.GetApplicationDrawable("myicon") 'without the file extension!
....

Again, I ask, HOW do I get an image file into the res/drawable folder ?

I have read everything I can find. Everywhere they tell you how to split up resources and how to access them. Ecliple say COPY/PASTE in to the res folder. But this just gets deleted at compile time for b4a.

So, I know now I am missing something very basic here.
Please explain the method of adding recources (image file) to my project?

I don't mean asset files. I'm OK with this.
 
Upvote 0
as @eurojam stated ...
Put your icon in the res\drawable folder (for ex. myicon.png), make it read only an then load it

So manually copy your icon to MyApp\Objects\res\drawable folder and change its file attribute to READ ONLY ! (this will stop it getting deleted)

then
Code: Copy
Notif.Icon = "myicon"  'no need for extension ..
 
Last edited:
Upvote 0
as @eurojam stated ...

So manually copy your icon to MyApp\Objects\res\drawable folder and change its file attribute to READ ONLY ! (this will stop it getting deleted)

then
Code: Copy
Notif.Icon = "myicon"  'no need for extension ..

Thankyou very much.
It now shows my new icon in the notification panel.

Although, if I file explore the folder on my phone at
sdcard/android/data/myapp/files/virtual_assets/objects/res/drawable
I can not find my icon file here.

So I am still not sure what mechanism is taking place to access myicon.
I thought it would be held as a file in this folder for myapp on my phone.
Do you have any further info regarding this.
I would like to better understand.

Thanks again.
 
Upvote 0
So I am still not sure what mechanism is taking place to access myicon.
I thought it would be held as a file in this folder for myapp on my phone.
Do you have any further info regarding this.
I would like to better understand.

Thanks again.
Maybe someone with more neurons will be able to help there ..
 
Upvote 0
Put your icon in the res/drawable folder (for ex. myicon.png), make it read only an then load it
Code: Copy
....      
        Dim AndroidResources1 As AndroidResources
        Dim Mydrawable1 As BitmapDrawable
        Mydrawable1=AndroidResources1.GetApplicationDrawable("myicon") 'without the file extension!
....
Why B4A delete files in resource folder? This is inconvenience that have to mark it readonly after checkout project from source control.
 
Upvote 0
Why B4A delete files in resource folder? This is inconvenience that have to mark it readonly after checkout project from source control.
Posting to an old thread is a mistake.
You should always create a new thread for your issues.

You can use additionalres directive and put the files into this folder (in correct subfolder).
B4X: Copy
#additionalres: ..\Resource
Resource is a folder in the Projectfolder beside Files-Folder.

Files in Resource will not be deleted at compiletime.
 
Upvote 0
Back
Top