Android Code Snippet Adaptive Icons - simple instructions and tips

Vinians2006

Active Member
Licensed User
Longtime User
I will wait for this resource to be added to Basic4Android because I tryed a lot but my program crash, so I ended up with simple "Choose Icon" on the menu that works fine.
 

TILogistic

Expert
Licensed User
Longtime User
1.- Download.



2. Unzip and find the android directory.





3. Add the resource directory where the icons are in your project.

Note: rename android directory to icon



4. Add the directory where the icons are to your project.



4. Add the following to the manifest.


If you want to upload your own custom icon

1.- Choose file




And proceed with the steps mentioned above.

See the loaded demo

Regards.
 

Attachments

  • Adaptive Icons.zip
    184.3 KB · Views: 416
Last edited:

Vinians2006

Active Member
Licensed User
Longtime User
Friend your explanation is clear, but the icon do not appears and the program closes before open the main actitvity. I dont know what is wrong, I tryed everything.
Please, can you help-me ? I attached the whole project in this post.
 

Attachments

  • NSMobile.zip
    110.7 KB · Views: 262

Vinians2006

Active Member
Licensed User
Longtime User
These should be used on your website and on Play Store.

View attachment 105587

Unzip the zip file and copy it to your project directory:

View attachment 105590

Your project is fine icon resource declarations.
the problem could be elsewhere..
Thank you but I think the zip I attached were not complete. Now this one is complete. Please, can you look at the files and see if you find any error ? Because Android dont even is able to load the apk. This is realted to icon because if I use that options to set an icon it works propertly.
The file is big to attach so here is the linke to google drive:
Link to download
 

TILogistic

Expert
Licensed User
Longtime User

Open a new post for inquiries.
 

johnaaronrose

Active Member
Licensed User
Longtime User
Apologies for my last incorrect post: it's obvious what to do if I had not had a senile moment! I just noticed the Download button on the web site. I've clicked on the Android instruction. But when I click on the Download button, it gives 2 options: one for iOS with Adaptive icon button & one with iOS with Legacy button only. I clicked on the Adaptive button and I noticed that the ic_launcher zip contains a folder for iOS and a folder for Android.

The generated images (in their sub-folders) look Ok. But the changes in the manifest are not reflected in the example project! I have attached a file showing the manifest in the example project together with a zip file of that project as well as the changes. If the changes are correct where do hey go in the standard manifest?

Would not doing the Adaptive Icons procedure prevent a search (from a phone) on Google Play Store from finding an app even though it's gone live on the Play Store?
 
Last edited:

ciginfo

Well-Known Member
Licensed User
Longtime User
hello
Unable to get the icon with correct size.
I create an icon directory in which 2 subdirectories mipmap and mipmap-xxxhdpi.

I write in the Main:
B4X:
#SupportedOrientations: portrait
    #CanInstallToExternalStorage: False
    #AdditionalRes: ../icon
And in the manifest :
B4X:
SetApplicationAttribute(android:icon, "@mipmap/ic_launcher")
CreateResource(mipmap-anydpi-v26, ic_launcher.xml,
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@mipmap/background"/>
<foreground android:drawable="@mipmap/foreground"/>
</adaptive-icon>
)
And here is the result, the icon which is not in the right dimension.
Where is the problem please?
Merci
 

TILogistic

Expert
Licensed User
Longtime User
test Android 13 and 14


Use:
Load image and adjust in the grid

Background color

 

Attachments

  • Adaptive Icons.zip
    469.6 KB · Views: 30
Last edited:

ciginfo

Well-Known Member
Licensed User
Longtime User
Cookies are required to use this site. You must accept them to continue using the site. Learn more…