How to modify text for menuitem ?

basicall

Member
Licensed User
Longtime User
Hi,

After I add a menuitem with Activity.AddMenuItem2, how could I modify text for the menuitem ?
 

JonPM

Well-Known Member
Licensed User
Longtime User
Do you mean change the text while the app is running? I don't think this is possible with the default AddMenuItem. You would have to create your own menu or use one of the libraries.
 
Upvote 0

basicall

Member
Licensed User
Longtime User
Do you mean change the text while the app is running? I don't think this is possible with the default AddMenuItem. You would have to create your own menu or use one of the libraries.


Sir,

> Do you mean change the text while the app is running?

Yes.


> I don't think this is possible

It will be a little issue. Suppose my application supports multiple-languages. After user selected another language, my application should be reponsible for refresh UI language. Isn't it ?


> You would have to create your own menu or use one of the libraries.

Sorry. Could not understand it.
 
Upvote 0

mc73

Well-Known Member
Licensed User
Longtime User
Sir,
It will be a little issue. Suppose my application supports multiple-languages. After user selected another language, my application should be reponsible for refresh UI language. Isn't it ?

You can set language selection to another activity. When user selects a new language, you can reload the main activity, and in activity_create redefine your menus.
 
Upvote 0

basicall

Member
Licensed User
Longtime User
You can set language selection to another activity. When user selects a new language, you can reload the main activity, and in activity_create redefine your menus.

Sir,

Thanks for your reply. In fact I did it in the same way as your suggestion:

In config activity, after user updated settings, he clicked a OK button,

B4X:
     ......

    Activity.Finish
   
    StartActivity(Main)

end sub

Now, main activity will run the Activity_Resume sub but not Activity_Create sub. So, no way to redefine menu. And, even it goes to Activity_Create sub I am not sure if could redefine menu because there does not exist activity.removemenuitem.
 
Upvote 0

mc73

Well-Known Member
Licensed User
Longtime User
when you start the 'language setup' activity, close the main activity by using activity.finish. this way, activity_create will run again.
 
Upvote 0
Top