1

I am developing with Xamarin.Forms. NET Standard class in C# to dynamically change the name of the application label that is set in the attributes of Droid/MainActivity.cs. Forexample "SG2022" to "NEW_SG20220214".

namespace SG2022.Droid
{
    [Activity(Label = "SG2022", Icon = "@mipmap/icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize )]
    public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
    {

NET Standard class in C#. For example, if I can change it from the LoginViewModel, how do I write it?

public LoginViewModel()
{
    LoginCommand = new Command(OnLoginClicked);
    Droid.Activity.Label = "NEW_SG20220214";
}

Is it possible to write something like

  • check this thread: https://stackoverflow.com/questions/44613974/how-to-change-android-application-name-in-xamarin-forms – Rafael Feb 14 '22 at 17:54
  • 1
    Thanks for your comment. However, the information in the thread in this link is not enough. The attributes in the information in the thread and also in the Manifest require the application name to be determined statically at compile time. I am looking for a way to dynamically change it from within the application. –  Feb 15 '22 at 06:10
  • Hope this link (https://social.msdn.microsoft.com/Forums/en-US/ce488ad6-476f-442e-94ad-9c163f2f07a8/dynamic-app-name-and-app-icon-in-xamarinforms?forum= xamarinforms) can help you. – Wen xu Li Feb 16 '22 at 09:42
  • Thanks Wen for your comment. However, the information in the thread in this link is not enough. –  Feb 17 '22 at 05:57
  • This link (https://stackoverflow.com/questions/48337869/how-can-i-change-the-application-name-in-xamarin-android) is a modification through code. – Wen xu Li Feb 21 '22 at 09:40

0 Answers0