Android Question change programmatically the icon on a menuitem

acorrias

Member
Licensed User
Longtime User
Hi all
I have an app using TABSTRIP library.

I need to change the icon of a menuitem programmatically as a switch. I show in the accivity menu an italian icon with language app set to english. When I press the italian icon, the language must switch to italian and the icon must switch to english.
B4X:
Activity.AddMenuItem3("MenuItem", "uk", LoadBitmap(File.DirAssets, "ic_uk.png"), True)

Is it possible to do this?

Thanks in advance
Alex
 

DonManfred

Expert
Licensed User
Longtime User
Is it possible to do this?
No.

You need to use an Alternative for your Navigation which is editable). For AppCompat for example there is a tutorial on how to create editable menus.
 
Upvote 0

acorrias

Member
Licensed User
Longtime User
I cannot manage appcompat.
I get some errors so I abandoned that library. I lack of knowhow about the proper version of android support library to use (I have 23.2.1) and the style resources (I don't know if I need some folder named values-v20 or values-v23 or other way).

I get errors launching app, even if I think to have followed what is suggested in the appcompat related post.

I have to find a workAround.

Do you think that it is no possible to switch icons even using reflection or javaobject libs?

Any way, I have the solution, as last chance, to add "settings" icon (a gear) with two submenus, one for each language

thanks
alex
 
Last edited:
Upvote 0
Top