Xamarin: The structure of the Android project (part 5)

In the next installment of our series on the topic of Xamarin, we will be delving into an introduction of the structure of the Android project, which is completely different from iOS.

Struktura_android_projektu_1

Solution Explorer

The Android project is again part of the entire solution, just as in the case of iOS. Familiar items from the iOS Project Properties and References are again available here. And their structure does not differ much either. Properties contains the file AssemblyInfo with metadata and the project version. In addition, the so-called AndroidManifest is in it. This file has a similar function as the Info.plist in iOS. There is a definition of the version of the application, permissions for access to different sensors, application icons etc. Within References, local libraries, projects and nugget packages to the project are available.

Struktura_android_projektu_2-1024x486

Editing of the Android Manifesto

 

Resources

The folder that contains the folder with the UI definition. This includes layouts, images, color definitions etc. (all definitions are written in XML). For division, Google opted for different display definitions of expanded folder names. As an example, I will mention folders for the icon definitions:

  • drawable
  • drawable-mdpi
  • drawable-hdpi
  • drawable-xhdpi

The definitions of all folders:

  • Drawable – folder that contains the pictures. Since Android supports several types of displays, it is necessary to prepare the images at different resolutions.
  • Layout – definition of screen layouts
  • Colors – folder with the color definitions
  • Arrays – definitions of static fields, eg. for preferences
  • Values – folder containing language string definitions
Struktura_android_projektu_3

An example of a layout definition

In addition to these folders and their files, the Resource.Designer file, which automatically assigns the defined resource identifier, is also visible here. If the identifier is not assigned automatically, it is necessary to REBUILD the project.

Other

Other files consist only of .cs files. For example MainActivity, which defines the logic of the basic screen in Android. Just as in iOS, a screen with components is present here as well.

 

The previous installment of the series:

Xamarin: Structure of the iOS project (part 4)

Xamarin: Hello world ve Visual Studiu (part 3)

Xamarin: First steps (part 2)

Xamarin: Xamarin: Introducing a tool for cross-platform development of mobile applications (Part 1)

Lubos Melichar

RSS