First steps in Android for a .Net developer

I always wanted to make some mobile applications for my phone, but never got to it. Mobile App development, both on Android and on iOS is quite different from web, and can be scary. I made some time and try to get the kids interested, so let’s see how it goes.

As a .Net developer, of course, I use my Windows 10 machine.

  1. First of all, you need Android Studio, it’s free, and fairly easy to install, even though it will take a while.
  2. Now you have to get your emulator to work. This may need some BIOS settings (no kidding) for this to work. This can be hard but is worth the trouble.
  3. Time to create your first project.

Now you get to the new project. The templates are not that different one from the other, so start with an empty activity.

An activity is a screen. In your app, only one screen will be available at any time. So you need to put all your code there and plan according to the main screens “activities” you want. If you want to share a part of a screen with other you will use ‘fragments’, which is the equivalent of a ‘usercontrol’.

The controls on the screen are defined by an XML file, called “activity….xml” in the “/res/layout” folder. You can as many activity¬†files like this as you like. You must define in the manifest.xml file which one will open first, and also list the available activity files in your app.

But how do you make a layout? Being a web developer this is a breeze. Dump the default constrainLayout, that is for dummies. Use the LinearLayout and RelativeLayout’s instead. You can nest them as you like.

The controls / widgets such as buttons or labels in the activity are not really controls yet. They will just appear there and in the code you have to add an event handler to them for them to do something. Not quite the .net controls that you drag in an click to open the handler, so you will quickly get better at copy&paste.


Leave a Reply

Your email address will not be published. Required fields are marked *