Android Question Adadptive Icon Clarification

drgottjr

Expert
Licensed User
Longtime User
I am attempting to address adaptive icons. In forum post:
https://www.b4x.com/android/forum/threads/adaptive-icons.95244/
there is a link to creating adaptive icons and instructions for adding them to our B4A projects.

I found the instructions relating to creating adaptive icons incomprehensible. (Sadfully, only the command line makes any sense to me at this point in my life. But I digress.) So I downloaded Android Studio since I had read it can create adaptive icons for you. It does!

Basically, import the icon from your B4A project into a dummy Android Studio app, 2 button clicks, and you have more adaptive icons than you'll ever need. And that's the problem.

Please refer to attached image adapt.png. After Android Studio creates your adaptive icons, you end up with 6 folders with names beginning with "mipmap". Each of the folders (except the first) contains 3 images: ic_launcher.png, ic_launcher_foreground.png and ic_launcher_round.png.

Please refer to attached image adapt2.png. These are the instructions from the abovementioned post to the forum. You see the issue.

I'm guessing I could select one of the folders, rename it mipmap and rename the images in it to conform with the instructions in the post. But which folder? And are the auto-generated images, in fact, the same as those mentioned in the forum post? The names are more or less the same as those mentioned in the forum post, but not exactly. Simply renaming something doesn't make it so...

Or could I add all the folders to Object\res and, perhaps, edit the manifest? But what, exactly, should the manifest say in this case? And would all the images in the folders have to be read only?
 

Attachments

  • adapt.png
    adapt.png
    24.3 KB · Views: 172
  • adapt2.png
    adapt2.png
    31.6 KB · Views: 181
  • adapt.png
    adapt.png
    24.3 KB · Views: 140
  • adapt2.png
    adapt2.png
    31.6 KB · Views: 139

drgottjr

Expert
Licensed User
Longtime User
Welcome back. So, selecting a folder and renaming it and the images in it, and adding them to Objects\res
in the project and editing the manifest as per the tutorial all work just fine. I have an adaptive icon.
Thanks for that.

However, Android Studio didn't generate a "background" image. But I'm man enough to say that I probably
made a mistake, so I'll be heading back to the drawing board to try again.

Attached please find studio.png. These are the images that Android Studio generated for folder
mipmap-xhdpi. (It's the same for all the other folders mentioned previously). I renamed the folder
and the images, but simply renaming ic_launcher_round.png as background.png doesn't actually make
it the kind of background we're looking for.

When foreground.png and background.png are combined to produce the app's adaptive icon, it just looks like a
poorly done photoshop effort where some object is brought to the front, but unwanted parts of the background are
still visible. With luck, a proper background image should do the trick.

I'm pretty sure I had selected background when working with Android Studio's image asset feature, but it looks
like I was somewhere else.
 

Attachments

  • studio.png
    studio.png
    19.5 KB · Views: 140
Upvote 0

drgottjr

Expert
Licensed User
Longtime User
Tried again with Android Studio. No background image generated (see attached). But I did supply an image with a transparent background, and the resulting adaptive icon looks like other adaptive icons on my nexus5x and pixel3a. same size, same general feel (especially when compared to older style icons sitting next to it). But they're all so small, it's hard to tell exactly what I'm seeing. Actually, I could see things more clearly with my old style icon. I don't see how others can get such detail on so small an image. Maybe time for a new icon (or a new artistic director). I would like to know how to get Android Studio to generate a background image, though.
 

Attachments

  • studio.png
    studio.png
    26 KB · Views: 139
Upvote 0

drgottjr

Expert
Licensed User
Longtime User
So, here's what seems to happen: Android Studio doesn't appear to create a background image, even though it gives the impression it's creating one. What you get is a background .xml file based on the background color you choose. It shows you an image -the background - but a .png is not found anywhere. Android Studio generates 3 images: the foreground, a so-called "round" image and the old ic_launcher. The various dp versions are all saved neatly in their respective folders. No background.png anyway. Only an .xml file in drawable.

Your B4A project's manifest is looking for background.png in the mipmap folder. You won't have one, and renaming the "round" image, technically works, but the masking to build an adaptive icon doesn't give you what you're expecting.

I created a background image 32bit 216x216px (apparently 108dp, if I understand the ratio correctlly) with some random color different from what I had indicated in Android Studio to make sure the masking process was doing what I thought was supposed to happen. I saved it to the mipmap folder as background.png, and built the project. The resulting adaptive icon looks better than what I got yesterday, it reflects the test color of my self-generated background image, and it looks much sharper and just like the other apps' adaptive icons on my nexus5x and pixel3a. And an even nicer old style icon appears on an older device running Android 5.1, I think.

FWIW
 

Attachments

  • adaptives.png
    adaptives.png
    14.7 KB · Views: 137
Upvote 0
Top