简体   繁体   中英

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"
在此输入图像描述

What I desired was to install this as one Application, but the output was like this:
在此输入图像描述
2 "Android Two" applications ..

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".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM