• Develop HelloWorld Android App with Xamarin, C#, and Visual Studio

    by  • November 23, 2016 • Android with C# and .NET, Xamarin Mobile App Development • 0 Comments

    Let’s get the ball rolling with the exciting stuff and develop our first HelloWorld Android app with Xamarin using C# in Visual Studio. I’ll explain the detailed concept of Android development and android apps in the future posts, while this post will only give you a flavor of Xamarin Android app development with a simple HelloWorld app.

    Creating a new Xamarin.Android project with Visual Studio is similar to creating any other project. You select “File -> New Project” and then select “Android” from templates categories and select “Blank App (Android)” template. Name the project as “HelloWorld” and specify the location where you would like to save the project code.


    After you click “OK”, you’ll see the Solution in Solution Explorer, just like any other .NET Solution with a Project. I’ll explain the project structure in the next post, but you can see that it looks familiar. From the Resources folder double click Main.axml under layout folder to view the layout of the main Android app screen. Once you can see the layout, drag a text view and a button on the layout.


    If you see an error while displaying the layout in designer mode like Android SDK version is older, you can use Android SDK Manager to get the latest SDK.


    Now open the MainActivity.cs file and edit it to write the code behind this layout. We’ll add the code to display ‘Hello World’ and ‘Good Bye’ alternatively when we click the button. The complete code in the MainActivity.cs file should look like the following.

    It’s now time to run the project and see the result of our efforts. You can simply run the project in Visual Studio as usual and the output will be shown in an Android Simulator. This is how the Android App should look like in the simulator.


    Did your HelloWorld app work? 🙂 If not the first time, don’t worry, you can leave a comment and ask any query related to this topic. I’ll answer it.


    Best WordPress Themes and Plugins with Great Team and Support!

    Avatar of admin


    GetCodeSnippet.com provides you high quality Microsoft .NET development related articles, tutorials and sample code for ASP.NET, C#, VB.NET, AJAX, WCF, WPF, Web Services, Windows Services, SQL Server and other technologies.

    Leave a Reply