Android Question Displaying a custom icon of application

Lakhtin_V

Active Member
Licensed User
Longtime User
I am debugging my application and want to see a specially created icon for my application on the smartphone screen. What features should be specified in the manifest and where exactly should the file with the icon be placed? What parameters should the file with the icon have? I follow the recommendations on this forum, but the problem is not solved, the icon looks standard - a blue leaf or a green robot's head.

In manifest
B4X:
SetApplicationAttribute(android:icon, "icon1.png")
SetApplicationAttribute(android:label, "Spector_V1.01")
SetApplicationAttribute(android:largeHeap,"true")
SetApplicationAttribute(android:usesCleartextTraffic,"true")


1740320745259.png
List of Files.PNG
 

Lakhtin_V

Active Member
Licensed User
Longtime User
his hasn't helped yet, the icon is still standard, After installing the application via the bridge. Maybe there is some connection with the creation of a new configuration package and there are nuances in installing the application.
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
If the icon is not updated, try uninstall the app and compile again.
Nothing special need to be done to the manifest editor to change the icon. The IDE takes care of it.
 
Upvote 0

teddybear

Well-Known Member
Licensed User
If you want to display a customized icon of application, you just need to replace this icon.png

icon.png
 
Upvote 0

drgottjr

Expert
Licensed User
Longtime User
i think teddybear has summed things up, but just in case you didn't look close enough at his attached image:
the default location for the icon is Objects\res\drawable. the default image is icon.png.
the easiest way to have your custom icon be the app icon is to put your custom icon in
Objects\res\drawable, delete icon.png and rename your custom icon icon.png. and to be
on the safe side, set its attributes to readable (you can try without performing that step).

the ide expects to find some things where it expects to find them. unless you have the
manifest say otherwise, the ide will look for (or create) a default icon.png in Objects\res\drawable.
sometimes - at least in the old days - it would overwrite custom elements with its default elements.
that is why i suggest making your custom icon.png readable only. this stops the ide. but you are
welcome to try without that step. worst case, you re-copy your custom icon and make it readable only.

that said, and in the spirt of full disclosure, this is not the only place where you can put
icons. adaptive icons are located in several folders.
 
Upvote 0

mcqueccu

Well-Known Member
Licensed User
Longtime User
@aeric has given you exactly what you needed.

Make sure to restore the manifest icon line to default.
B4X:
SetApplicationAttribute(android:icon, "@drawable/icon")

Then Menu bar:
Project->Choose Icon (Then browse and select the image you want)

For Android the icon size should be 512 x 512.
After setting, you can Clean your project and run the app. You can also Use @teddybear method to verify if the icon image has been changed, from that location
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
If you want to change the default icon in B4A, replace the file hdpi_icon.png (128x128) in B4A installation directory (same path of B4A.exe).
If you didn't choose an icon, B4A will use this icon as your app icon.

default icon
replaced icon
App icon
 
Upvote 0

Lakhtin_V

Active Member
Licensed User
Longtime User
If I understood correctly, I was offered two different methods of using a custom icon. Method 1 is replacing the icon at the debugging and development stage, here it is better to replace the main B4A icon. In the B4A service directory. Method 2 is to use the menu item Project->Choose Icon for installing a custom icon in the package for distribution to users. Both methods are fundamentally different. But what if I am simultaneously developing and debugging several applications at the same time. Then method 1 will not be convenient. I hoped that the line in the manifest and placing the icon inside the directory with files would be the most optimal.
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
In most cases, my answer in post #2 is the way to go.
A single icon.png file is stored in Objects\res\drawable for each project.
You don't need to manually edit the manifest.
I don't understand your case and I think you are making things more complicated.
 
Upvote 0

Brian Dean

Well-Known Member
Licensed User
Longtime User
But what if I am simultaneously developing and debugging several applications at the same time.
You seem to be saying that changing the icon as @aeric suggests in post #2 changes the icon for all new projects. That is not the case; only the icon of the current project is changed. You can give each of your projects a different icon - quite simple.
 
Upvote 0

Lakhtin_V

Active Member
Licensed User
Longtime User
In most cases, my answer in post #2 is the way to go.
A single icon.png file is stored in Objects\res\drawable for each project.
You don't need to manually edit the manifest.
I don't understand your case and I think you are making things more complicated.
After I clicked the menu item Objects\res\drawable at the address you specified, my file appeared there. But when installing via Bridge on the phone, the icon still turns out to be standard. I still don't understand what size the icon should be in the place you specified, maybe this is the reason or that I am installing via Bridge
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
Check this:

The instruction is here:
 
Upvote 0
Top