Demonyowh
Demonyowh

Reputation: 1672

How to install two activities as one application in Xamarin Android C#

I am new to Xamarin Android C# development and still reading tutorials .. And I'm having a hard time merging two activities in one application .. Though I followed all the instructions in the tutorial I wonder why this happen .. I hope someone could somehow help me with this ..

I have 2 activities: "FirstActivity" and "SecondActity"
enter image description here

What I desired was to install this as one Application, but the output was like this:
enter image description here
2 "Android Two" applications ..

Upvotes: 3

Views: 1633

Answers (1)

matthewrdev
matthewrdev

Reputation: 12190

You probably have the MainLauncher attribute set to true on both of ActivityOne and ActivityTwo.

EG:

[Activity (Label = "Activity One", MainLauncher = true)]
public class ActivityOne : Activity
{
    // ...
}

And...

[Activity (Label = "Activity Two", MainLauncher = true)]
public class ActivityTwo : Activity
{
    // ...
}

Remove the MainLauncher = true attribute from one of those activities and your application will then only have one launcher.

See this documentation under the section titled "Launchable from Application Chooser".

Upvotes: 7

Related Questions