Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Mastering Xamarin UI Development
Mastering Xamarin UI Development

Mastering Xamarin UI Development: Build robust and a maintainable cross-platform mobile UI with Xamarin and C# 7 , Second Edition

eBook
€8.99 €29.99
Paperback
€36.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

Mastering Xamarin UI Development

Building a PhotoLibrary App Using Android

In the previous chapter, we learned how to download and install the Visual Studio for Mac IDE as well as the Xamarin Platform SDKs and components for both the iOS and Android platforms. We also covered some of the features contained in the Visual Studio for Mac IDE and then dived into learning about the Xamarin Mobile platform, as well as the benefits of developing Native versus Xamarin.Forms apps.

We learned how to create a cross-platform Xamarin project for both the iOS and Android platforms, and constructed the user interface by using the XAML syntax and writing the C# code that will be used to communicate with the XAML to populate a ListView control with planet names.

Finally, we learned how to set breakpoints and create conditional breakpoints, as well as using the built-in debugger in the Visual Studio for Mac IDE, which allows you...

Creating a native Android app using Visual Studio for Mac

In this section, we will take a look at how to create a native Android solution for the first time. We will begin by developing the basic structure for our application, as well as adding the Xamarin Media Plugin NuGet package and designing the user interface using XML for our PhotoLibrary application.

We will also learn how to update the Strings XML file to include values for our UI control elements that are contained in our XML file. Finally, we will create the styles XML file for our Photo Library app that will be used to style our UI control elements.

Before we can proceed, we need to create our PhotoLibrary project. It is very simple to create this using Visual Studio for Mac. Simply follow these steps:

  1. Firstly, launch the Visual Studio for Mac application.
  2. Next, choose the New Solution… option, or alternatively...

Creating and implementing the PhotoLibrary Activity class

In this section, we will start by creating the PhotoLibrary Activity class that will be used to interact with our PhotoLibraryUI user interface, and handle when each of the buttons has been pressed.

Let's start by creating the PhotoLibraryActivity class for our PhotoLibrary app in the following steps:

  1. Ensure that the PhotoLibrary solution is currently open in the Visual Studio for Mac IDE.
  2. Next, right-click on the PhotoLibrary project and choose Add|New File... from the pop-up menu, as shown in the following screenshot:
Creating a new Android Activity Class
  1. Then, choose the Activity option under the Android section and enter PhotoLibraryActivity for the name of the new Activity file to be created, as shown in the following screenshot:
Creating the PhotoLibraryActivity Class
  1. Next, click on the New button to allow...

Implementing Material Design in the PhotoLibrary app

In the previous sections, we looked at how to create the user interface for our app, update the Strings.xml file, and create the styles.xml file. Lastly, we looked at creating PhotoLibraryActivity and making some changes to the MainActivity class.

In this section, we will learn how to go about creating and implementing custom Material Design Themes, and how to implement Material Design in the PhotoLibrary application.

Creating custom themes for the PhotoLibrary application

Creating custom themes for your apps is extremely easy. Android themes are similar to using CSS style sheets in your web applications for user interface design. Themes allow you to separate styles from...

Setting up camera and photo album permissions

Before we can start accessing the camera and photo album, we will need to assign certain permissions for our PhotoLibrary Android app. To do this, we need to make some changes to our Android Manifest file to give access to our camera and photo album.

Let's start by updating the AndroidManifest.xml file for our PhotoLibrary app by performing the following steps:

  1. Expand the Properties folder in the PhotoLibrary solution and double-click on the AndroidManifest.xml file. Ensure that you have selected the Source button, which is located at the bottom of the screen, as shown in the following screenshot:
Setting up Camera and Photo Album Permissions
  1. Then, ensure that the AndroidManifest.xml file is displayed in the code editor and enter the following code snippet:
     <?xml version="1.0" encoding="utf-8"...

Launching the Photo Library app using the Android emulator

In this section, we will take a look at how to compile and run our PhotoLibrary. You have the option of choosing to run your application using an actual device or choosing from a list of emulators available for an Android device.

Let's begin by performing the following steps:

  1. Ensure that you have chosen the PhotoLibrary project from the drop-down menu.
  2. Next, choose your preferred device from the list of available Android emulators.
  3. Then, select the Run|Start Debugging menu option, as shown in the following screenshot:
Launching the PhotoLibrary App within the Android Emulator
  1. Alternatively, you can also build and run the PhotoLibrary application by pressing Command + Enter.

When the compilation is complete, the Android emulator will appear automatically and the PhotoLibrary application will be displayed, as shown...

Summary

In this chapter, we focused primarily on how to develop a native Android app using Visual Studio for Mac, Xamarin.Android, and C#. You learned how to use and work with the Visual Designer in the Visual Studio for Mac IDE to construct the user interface for your PhotoLibrary app using XML and implement Material Design in your apps, as well as create your own custom themes and then apply theming to your app.

Finally, you learned how to provide the necessary permissions to AndroidManifest.xml so that we can interact with the device camera and photo album, before launching the app in the Android emulator. In the next chapter, you will learn how to build a tile sliding game using Xamarin.iOS and C#.

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Build effective native and cross-platform user interfaces using the Xamarin frameworks for iOS and Android, as well as Xamarin.Forms
  • Maximize the testability, flexibility, and overall quality of your Xamarin mobile apps
  • Step-by-Steps guide that is packed with real-world scenarios and solutions, to build professional grade mobile apps and games for the iOS and Android platforms, using C# 7

Description

This book will provide you with the knowledge and practical skills that are required to develop real-world Xamarin and Xamarin.Forms applications. You’ll learn how to create native Android app that will interact with the device camera and photo gallery, and then create a native iOS sliding tiles game. You will learn how to implement complex UI layouts and create customizable control elements based on the platform, using XAML and C# 7 code to interact with control elements within your XAML ContentPages. You’ll learn how to add location-based features by to your apps by creating a LocationService class and using the Xam.Plugin.Geolocator cross-platform library, that will be used to obtain the current device location. Next, you’ll learn how to work with and implement animations and visual effects within your UI using the PlatformEffects API, using C# code. At the end of this book, you’ll learn how to integrate Microsoft Azure App Services and use the Twitter APIs within your app. You will work with the Razor Templating Engine to build a book library HTML5 solution that will use a SQLite.net library to store, update, retrieve, and delete information within a local SQLite database. Finally, you will learn how to write unit tests using the NUnit and UITest frameworks.

Who is this book for?

This book is intended for readers who have experience using at least the C# 6.0 programming language and interested in learning how to create stunning native, and cross-platform user interfaces for the iOS and Android platforms using the Xamarin and Xamarin.Forms frameworks using C# 7.

What you will learn

  • Downloading and Installing the Visual Studio for Mac IDE
  • Overview and Understanding of the Xamarin Mobile Platform
  • Understand the MVVM architectural pattern and how to implement this with your apps
  • Build a NavigationService class to enable navigation between your ViewModels
  • Implement Data-Binding to control elements within your XAML pages and ViewModels
  • Create and Implement Xamarin.Forms Animations within your applications
  • Work with the Microsoft Azure App Services Platform and the Facebook SDK

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Aug 31, 2018
Length: 584 pages
Edition : 2nd
Language : English
ISBN-13 : 9781788998529
Vendor :
Microsoft
Category :
Languages :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : Aug 31, 2018
Length: 584 pages
Edition : 2nd
Language : English
ISBN-13 : 9781788998529
Vendor :
Microsoft
Category :
Languages :

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
€189.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts
€264.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 94.97
Xamarin.Forms Projects
€32.99
Mastering Xamarin.Forms
€24.99
Mastering Xamarin UI Development
€36.99
Total 94.97 Stars icon
Banner background image

Table of Contents

14 Chapters
Setting Up Visual Studio for Mac Chevron down icon Chevron up icon
Building a PhotoLibrary App Using Android Chevron down icon Chevron up icon
Building a SlidingTiles Game Using Xamarin.iOS Chevron down icon Chevron up icon
Creating the TrackMyWalks Native App Chevron down icon Chevron up icon
MVVM and Data Binding Chevron down icon Chevron up icon
Navigating Within the Mvvm Model Chevron down icon Chevron up icon
Adding Location-based Features Within Your App Chevron down icon Chevron up icon
Customizing the User Interface Chevron down icon Chevron up icon
Working with Animations in Xamarin.Forms Chevron down icon Chevron up icon
Working with the Razor Templating Engine Chevron down icon Chevron up icon
Incorporating Microsoft Azure App Services Chevron down icon Chevron up icon
Making Our App Social Using the Twitter API Chevron down icon Chevron up icon
Unit Testing Your Xamarin.Forms Apps Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Full star icon Full star icon Full star icon Full star icon 5
(1 Ratings)
5 star 100%
4 star 0%
3 star 0%
2 star 0%
1 star 0%
Amazon Customer Jan 07, 2019
Full star icon Full star icon Full star icon Full star icon Full star icon 5
While this book is ultimately about about UI development with Xamarin, it fortunately does not assume too much about you besides an understanding of C# and OOP programming techniques. This is good as this is essentially a crash course on getting you up to speed with UI crossplatform mobile apps with Xamarin. Explanations was to the point and I was able to understand how the photoapp example in the book is built and run pretty quickly.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.