Prior to creating Android apps with Crosslight, it’s recommended that are familiar with the Android application development fundamentals such as the design patterns and the tools used to design the interface. Android Studio is recommended in aiding the visual creation of the user interface.
In software engineering, a design pattern is a general reusable solution to a commonly occurring problem within a given context in software design. The Android platform follows the Model-View-Controller pattern, similar to iOS development pattern. For more information regarding the MVC development pattern, please consult Design Pattern in iOS development pattern topic in iOS design pattern.
View, in Android context, is any class that subclasses the View class in Android with the Activity class as the Controller. The Activity may host multiple views that governs the interaction between the Model and the View while updating the View accordingly. Please consult the View class and Activity class in Android Developers documentation to learn more about the topics accordingly.
Crosslight combines the power of MVC and MVVM and provides a unified data binding framework for Android which streamlines the data flow between the View and the ViewModel. With Crosslight, this design pattern is improved and streamlined in many ways that you will be able to navigate between fragments just by using the navigation service from the View Model. To learn more about the MVVM, see Understanding Data Binding and MVVM Design Pattern – Part 2.
Crosslight 5 introduces a brand-new Crosslight Android Material library featuring comprehensive components, features and APIs that simplify the creation of modern Android apps. The new Android Material also introduces a much simplified programming pattern which dramatically transform the way Android apps is built.
With the availability of the new Material library, there are now two options for building Android apps with Crosslight:
- Crosslight Android Classic – represents the classic Android development pattern originally introduced in Crosslight. For more information, see Crosslight Android Classic Development.
- Crosslight Android Material – represents a modern Android development pattern with full Material support and simplified programming patterns. For more information, see Crosslight Android Material Development.
If you're just starting out a new Android project, please consider choosing Crosslight Android Material project to support latest Android platform and leverage newer API available in Crosslight.
Building Android Interface
To create rich and compelling apps, Android Developers Documentation has outlined in detail what aspects and standards to follow regarding mobile development in the Android platform. You can find it here: http://developer.android.com/design/index.html. The Pure Android article provide basic guidelines to keep in mind when designing interface for Android. Also consult Best Practices for User Experiences and UI documentation when designing your apps so that it is compatible for various screen sizes and form factors.
By default, after installing Xamarin.Android along with the Visual Studio extension, you can design interfaces for Android by dragging and dropping controls using the Android Interface Builder. Please consult Xamarin documentation on how to install the Xamarin Studio. The following screenshot illustrates the controls available via Visual Studio toolbox panel on the left, and Xamarin Studio on the right.
Designing interface that works on various Android devices can be daunting, especially when you don’t have resources to multiple devices at once. On 16th May 2013, Google has announced an integrated IDE that works very well for designing interfaces for Android that might save you hours of development time. One of the very interesting feature of the IDE that it allows you to preview the rendering of the layout you have defined in layout xml definition for multiple devices at once in different orientations. Refer to this document on how to install Android Studio.
A very important thing to note is the android:id you assign to each of the controls. This is the unique identifier that enables the data binding to work, using the Bindable Properties, as defined in the Binding Providers. To learn more about the basic concept of data binding, see Crosslight and MVVM at a Glance. To learn more about Binding Providers, see Understanding Binding Providers.
Since Crosslight is developed based on Xamarin technologies, normally you would use Xamarin Studio to develop Android applications on both Mac and Windows. Xamarin also ships with Visual Studio support which means you can use Visual Studio 2012 or higher to build Android apps. Development with Visual Studio means that you can take advantage of Visual Studio features that you are already familiar of and leverage them to build applications on the Android platform. For more information, see Preparing Your Development Environment.
The solution files from Visual Studio and Xamarin Studio are fully shareable and are fully compatible vice versa. This allows you to work with Android projects from the preferred development environments or switching between Mac and Windows using Parallels without losing the changes made in the project. Since the same project file is accessed directly between these IDEs, the changes are synchronized in real-time. This avoid complexity to create multiple projects that were linked through external tools.
The following screenshots illustrates development in both Visual Studio on Windows and Xamarin Studio on the Mac: