dlxeon
dlxeon

Reputation: 2010

Choose startup activity to debug with xamarin android

I have 2 activities, both marked as MainLauncher = true, which is desired behavior - I want to have 2 application shortcuts on device when installed. During development I want to choose particular activity which will be always shown when I debug this application. I use Visual Studio 2015 update 3, latest Xamarin.Android

[Activity(Label = "Activity 1", MainLauncher = true, Icon = "@drawable/iconMain"]
...

[Activity(Label = "Activity 2", MainLauncher = true, Icon = "@drawable/iconMain"]
...

Upvotes: 2

Views: 877

Answers (1)

Mark Verkiel
Mark Verkiel

Reputation: 1239

You could use #if to show the second activity only in debug mode:

#if DEBUG
    [Activity(Label = "Activity 2", MainLauncher = true, Icon = "@drawable/iconMain"]
#else
    [Activity(Label = "Activity 2", MainLauncher = false, Icon = "@drawable/iconMain"]
#end if

Upvotes: 1

Related Questions