Xamarin with Visual Studio. Launch your mobile development career by creating Android and iOS applications using .NET and C (Alessandro Del Sole)(Z-Library)
Mobile
No Description
157
Views
0
Downloads
0.00
Total Donations
Registered users can read the full content for free
Register as a Gaohf Library member to read the complete e-book online for free and enjoy a better reading experience.
Page
1
(This page has no text content)
Page
2
(This page has no text content)
Page
3
Xamarin with Visual Studio Launch Your Mobile Development Career by Creating Android and iOS Applications Using.NET and C# Alessandro Del Sole www.bpbonline.com
Page
4
Copyright © 2022 BPB Online All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews. Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor BPB Online or its dealers and distributors, will be held liable for any damages caused or alleged to have been caused directly or indirectly by this book. BPB Online has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, BPB Online cannot guarantee the accuracy of this information. Group Product Manager: Marianne Conor Publishing Product Manager: Eva Brawn Senior Editor: Connell Content Development Editor: Melissa Monroe Technical Editor: Anne Stokes Copy Editor: Joe Austin Language Support Editor: Justin Baldwin Project Coordinator: Tyler Horan Proofreader: Khloe Styles Indexer: V. Krishnamurthy Production Designer: Malcolm D'Souza Marketing Coordinator: Kristen Kramer First published: July 2022 Published by BPB Online WeWork, 119 Marylebone Road London NW1 5PU UK | UAE | INDIA | SINGAPORE ISBN 978-93-55511-874 www.bpbonline.com
Page
5
Dedicated to My wonderful wife Angelica, I’ll love you until the end
Page
6
About the Author Alessandro Del Sole is a senior software engineer working on building mobile apps with Xamarin in the healthcare industry. He has been using Xamarin since 2015 and is a Xamarin Certified Mobile Developer. Alessandro has also been Microsoft Most Valuable Professional since 2008, and has authored many technical books, eBooks, articles, instructional videos and has been speaker in the most important Italian conferences. He has also been recently appointed as C# Corner MVP.
Page
7
About the Reviewer Ninaada is a Xamarin certified mobile developer with 10+ years of industry experience. He has extensively worked on Xamarin based projects for more than 6 years, across various domains and industries including Fortune 500 companies. He also is active in the xamarin community by contributing to GitHub and blogging occasionally. Currently, he is working as a Xamarin developer with Steer73. He also has a keen interest in nature and wildlife photography, which can be found on his social media pages. Find more at https://linktr.ee/ninaada
Page
8
Acknowledgement I would first like to thank so much my wife, Angelica, who respects the time I need to write and that never stops to be supportive to me, always demonstrating to me so much love. I would like to then thank the team at BPB Publications for being so supportive. I have been authoring books for 15 years, but this was my first time with them, and the whole team made it simpler for me to approach to a different way of working. Special thanks to the amazing Arielle (https://imarielle.com), whose music has been my fuel during the many hours I spent writing. Finally, I would like to thank all the readers of this book and all those who have read other books or articles I wrote in the past years. Writing is a big effort, so you need a motivation to do it and having had good feedback over the years, is the right motivation for me to still write.
Page
9
Preface This book covers mobile app development from the point of view of the developer that wants to target both iOS and Android systems from one codebase, using development tools from Microsoft. The book is intended for both the experienced and the novice developers, with a special, practical approach for those who want to start a new career as software developers in the mobile apps industry. Basic knowledge of the C# programming language is recommended, however the book introduces general programming and language-specific concepts that will be used across the book, so that also the novice developer can be familiar with all the discussed topics. The goal of the book is explaining how to build mobile apps from the ground up, focusing on all the necessary aspects: the user interface, the logic, the interaction with Web services, the consumption of data, the way an app should be architected for mobile devices. Special focus is also offered for those who want to start searching a new occupation as software developers with a Microsoft technical background. This book is divided into 15 chapters. The first four chapters introduce the reader into the world of software development with C#, Microsoft Visual Studio and .NET. Chapters from 5 to 13 are all technical chapters that cover the development of mobile apps with Xamarin, in a cross-platform approach. The last two chapters have specific focus on starting, building, and maintaining a career as a successful mobile developer. Below you find the details of each chapter. Chapter 1 describes why it is important to be a mobile app developer today, and why building apps in a cross-platform approach is the best choice especially for jobseekers. Chapter 2 describes how Microsoft jumped into the mobile app development ecosystem. An introduction to Xamarin is made, plus a you find a discussion about why choosing Xamarin as the development platform can be the key to success today.
Page
10
Chapter 3 gives an introduction on the .NET technology (including the latest updates) and to Microsoft Visual Studio as a development environment Chapter 4 is intended to give absolute beginners a quick overview of the C# programming language to make them feel more comfortable with the development tools used across the book. Chapter 5 describes how to create a Xamarin solution with Microsoft Visual Studio, explaining how the code sharing strategy works to deliver apps to multiple OSes from the same codebase. Chapter 6 explains the fundamentals of user interface in mobile apps, and how to create adaptive and auto-sizing user interfaces using layouts. Chapter 7 chapter describes how to create the user interface of an app with the controls offered by Xamarin and how to manage user interaction with controls. Chapter 8 describes how to organize the user interface of an app in pages, the different kinds of pages and how navigation between pages works. Chapter 9 describes the concept of reusable resource and explains how to connect data objects to the user interface for automatic communication. It also explains how to use local SQLite databases to store, retrieve and display data. Chapter 10 discusses how to enrich the user interface of an app with brushes, shapes, and with media contents. Chapter 11 explains how to handle the different events of an app’s lifecycle and how to manage common requirements of mobile apps, such as network connection, battery level, local settings. Chapter 12 describes how to consume Web services in Xamarin projects, including Cloud services hosted on Azure. Chapter 13 describes how to access native iOS and Android APIs from Xamarin, pointing out how it is something to do only when the Xamarin and Xamarin.Essentials codebases do not have something that works cross- platform. It also describes how to implement customizations that are platform-specific. Chapter 14 helps you understand how to search for jobs that are related to mobile app development with Xamarin by making focused, appropriate job searches based on the reader’s experience after understanding the core
Page
11
business of a company that is hiring. Chapter 15 provides advice on what a good approach is in order to keep a job in the mobile app development market including tips & tricks to work in a team and to stay up to date with technology.
Page
12
Code Bundle and Coloured Images Please follow the link to download the Code Bundle and the Coloured Images of the book: https://rebrand.ly/ziayzy4 The code bundle for the book is also hosted on GitHub at https://github.com/bpbpublications/Xamarin-with-Visual-Studio. In case there's an update to the code, it will be updated on the existing GitHub repository. We have code bundles from our rich catalogue of books and videos available at https://github.com/bpbpublications. Check them out! Errata We take immense pride in our work at BPB Publications and follow best practices to ensure the accuracy of our content to provide with an indulging reading experience to our subscribers. Our readers are our mirrors, and we use their inputs to reflect and improve upon human errors, if any, that may have occurred during the publishing processes involved. To let us maintain the quality and help us reach out to any readers who might be having difficulties due to any unforeseen errors, please write to us at : errata@bpbonline.com Your support, suggestions and feedbacks are highly appreciated by the BPB Publications’ Family. Did you know that BPB offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the
Page
13
eBook version at www.bpbonline.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at: business@bpbonline.com for more details. At www.bpbonline.com, you can also read a collection of free technical articles, sign up for a range of free newsletters, and receive exclusive discounts and offers on BPB books and eBooks.
Page
14
Piracy If you come across any illegal copies of our works in any form on the internet, we would be grateful if you would provide us with the location address or website name. Please contact us at business@bpbonline.com with a link to the material. If you are interested in becoming an author If there is a topic that you have expertise in, and you are interested in either writing or contributing to a book, please visit www.bpbonline.com. We have worked with thousands of developers and tech professionals, just like you, to help them share their insights with the global tech community. You can make a general application, apply for a specific hot topic that we are recruiting an author for, or submit your own idea. Reviews Please leave a review. Once you have read and used this book, why not leave a review on the site that you purchased it from? Potential readers can then see and use your unbiased opinion to make purchase decisions. We at BPB can understand what you think about our products, and our authors can see your feedback on their book. Thank you! For more information about BPB, please visit www.bpbonline.com.
Page
15
Table of Contents 1. The Importance of Mobile App Development Introduction Structure Objectives The importance of mobile app development Mobile devices and applications A brief history of modern mobile devices Mobile devices for everyone Mobile devices everywhere The importance of mobile apps for companies Career opportunities with mobile app development Making money with mobile app development Summarizing how a mobile system works The importance of a cross-platform approach Limitations of cross-platform code Application size and performance Understanding native applications Demystifying application performance issues Staying up to date with new devices and platforms Getting updates from Apple Getting updates from Google Getting news from Microsoft Conclusion Points to remember 2. Xamarin and Microsoft in the Mobile App Market Introduction Structure Objectives Xamarin as the app development framework Mobile App Development with Microsoft Skills Xamarin as a company
Page
16
Introducing the mono project The transition to Xamarin Microsoft in the mobile app ecosystem The importance of Microsoft investments on Xamarin Improved productivity with Microsoft tools and services Understanding Xamarin and Xamarin.Forms Advantages of Xamarin.Forms Hints about .NET MAUI Installing and configuring the development tools System requirements for Xamarin System requirements on Windows System requirements on macOS Android and iOS Devices Installing and configuring Microsoft Visual Studio Selecting workloads Checking for individual components Configuring Android devices for developer mode Minimum macOS configuration Conclusion Questions Points to remember 3. Introducing .NET and Visual Studio Introduction Structure Objectives Introducing .NET Introducing the .NET framework for Windows Locating the .NET framework on disk The .NET framework architecture The Common Language Runtime (CLR) Compilers and the concept of Assembly Assemblies in .NET The Base Class Library From .NET Framework to .NET Core Advantages of .NET Core .NET 6: One .NET
Page
17
Building applications with Visual Studio Signing in with a Microsoft account Synchronized settings Introducing the Start window Understanding projects and solutions Creating projects with C# Creating your first C# project Working with the Visual Studio IDE Working with tool windows Solution Explorer The Error List The Properties window The Output window Editing project properties Editing application settings Basic code editing features Syntax colorization Zooming the code editor Introducing IntelliSense Changing the Code Editor options Compiling, running, and debugging code Understanding configurations Running and Debugging Code Debugging your code Preparing the sample project for debugging Breakpoints and data tips Detecting and fixing runtime errors Conclusion Points to remember Key terms 4. The C# Programming Language Introduction Structure Objectives Understanding data types Meet the Common Type System
Page
18
Clarifying value types and reference types .NET primitive types Declaring and consuming variables Clarifying the difference between value and reference types Common data operators Equals and Not Equals Operators Arithmetic operators Conversion operators Direct type conversion Converting types with the Convert class String conversion Logical operators Working with strings Checking for Null or Empty strings Concatenating strings Formatting strings Iterating objects Understanding loops Introducing the do loop Introducing the while loop Conditional code blocks The if conditional code block The switch conditional code block Introducing arrays Single-dimensional arrays Multi-dimensional arrays Jagged arrays Object-oriented programming (OOP) Understanding access modifiers Defining reference types with classes Storing information with fields and properties Running actions with methods Introducing constructors and static classes Defining derived types with inheritance Understanding interfaces and abstract classes Defining interfaces Implementing interfaces
Page
19
Introducing abstract classes Organizing types within namespaces Accessing types within namespaces with using directives Defining value types with structures Assigning structures to variables Visibility of structures and their members Defining enumerations Using enumerations Implementing error handling Implementing events Advanced C# programming Generics and Nullable Types Working with Nullable types Language INtegrated Query (LINQ) Asynchronous programming Conclusion Suggested readings 5. Building Apps with Xamarin and Xamarin.Forms Introduction Structure Objective Understanding Xamarin.Android Projects Understanding the project structure Drawing and handling the user interface Configuring the App Manifest Debugging an Android app Configuring debugging and Build options Understanding Xamarin.iOS projects Understanding the project structure Handling the user interface Debugging an iOS app Understanding provisioning profiles and developer accounts Configuring App Package options Cross-platform projects with Xamarin.Forms Understanding the project structure Introducing XAML, App.xaml, and MainPage.xaml
Page
20
Running and debugging apps Preparing apps for publication Preparing Android packages Preparing iOS packages Conclusion Points to remember Key terms 6. Organizing the User Interface with Layouts Introduction Structure Objectives Understanding the concept of layout Alignment and spacing options Understanding the visual tree .NET objects hierarchy Organizing the user interface Creating a Sample Project The StackLayout The FlexLayout The Grid Spacing, proportions and spans for rows and columns The AbsoluteLayout The RelativeLayout The ScrollView Controlling the ScrollView programmatically The Frame The ContentView Using a ContentView Styling the user interface with cascading style sheets Defining CSS styles as a XAML resource Consuming CSS files in XAML Creating and implementing CSS styles in C# Conclusion Points to remember Key terms
The above is a preview of the first 20 pages. Register to read the complete e-book.
AI Reading Assistant
Whole-book reading guide from stratified index samples; jump to passages in the text
AI guide
# Xamarin with Visual Studio: Launch Your Mobile Development Career
## 【One-Line Pitch】
A practical, career-oriented guide for developers who want to build Android and iOS apps with C# and .NET, covering everything from environment setup to job hunting. Ideal for Microsoft-stack developers and absolute beginners who want a single book that takes them from zero to employable Xamarin developer.
## 【Book Arc】
- **Opening (~0%–10%)**: Introduces the mobile app market landscape, compares cross-platform technologies (including Cordova, Ionic, and others), and explains why Xamarin and Xamarin.Forms are strategic choices. Covers Xamarin's history since Microsoft's acquisition and outlines system requirements for Windows and macOS.
- **Early (~10%–23%)**: Walks through installing and configuring Visual Studio 2022, creating first C# projects, understanding the IDE's key windows (Output, Solution Explorer, Properties), and learning essential debugging techniques with breakpoints and tool windows.
- **Early (~23%–32%)**: Delivers a fast-paced C# crash course for absolute beginners—covering variables, arrays, switch statements, classes, constructors, static classes, inheritance, enumerations, and error handling—all framed as prerequisites for Xamarin development.
- **Middle (~32%–48%)**: Moves into actual Xamarin project creation: understanding Xamarin.Android and Xamarin.iOS project structures, configuring app manifests, managing provisioning profiles and Apple developer accounts, and introducing XAML for cross-platform UI definition with Xamarin.Forms.
- **Middle (~48%–65%)**: Dives deep into user interface fundamentals—layouts (StackLayout, Grid, FlexLayout, AbsoluteLayout), ScrollView, adaptive and auto-sizing UI design, and how to organize pages and implement navigation between them.
- **Late (~65%–100%)**: Covers advanced topics: reusable resources, data binding, SQLite local databases, brushes/shapes/media, app lifecycle events, network and battery monitoring, consuming Web services (including Azure cloud), accessing native iOS/Android APIs when needed, and concludes with career guidance—resume preparation, LinkedIn strategies, and interview tips.
## 【Key Takeaways】
- **Xamarin.Forms enables true code sharing across platforms** (Early): The same C# codebase can target Android, iOS, and UWP, with XAML defining UI once. This is the core value proposition that makes Xamarin cost-effective for companies and productive for developers.
- **Visual Studio 2022 Community edition is free and sufficient** (Early): Microsoft's free IDE tier includes all necessary Xamarin tooling, Android SDKs, and emulators. Recommended hardware is 8GB RAM minimum, with Windows 10+ for UWP support.
- **C# fundamentals are non-negotiable prerequisites** (Early): The book's crash course covers arrays, switch statements, classes, inheritance, static classes, and enumerations—all essential for understanding Xamarin code examples. Beginners should expect to spend real time here.
- **iOS development requires a Mac for building** (Middle): Even with Visual Studio on Windows, you must pair to a Mac with Xcode to compile iOS apps. Free Apple developer accounts work for debugging but cannot distribute apps—a critical constraint to know upfront.
- **XAML is XML-based and maps directly to visual elements** (Middle): XML nodes become visual elements, attributes become properties. Understanding this mapping (ContentPage, StackLayout, Frame, Label) unlocks the entire Xamarin.Forms UI paradigm.
- **Layouts are the foundation of adaptive UI** (Middle): StackLayout, Grid, FlexLayout, and AbsoluteLayout each solve different arrangement problems. FlexLayout is particularly versatile for unknown-size content, while ScrollView adds scrolling to any visual hierarchy.
- **Async/await is used constantly in Xamarin** (Middle): Long-running operations must not block the UI thread. The book emphasizes this pattern early because it appears throughout mobile development—from data loading to web service calls.
- **Career strategy is part of the technical journey** (Late): The book explicitly covers resume preparation, LinkedIn optimization, online community participation, and interview preparation—treating job hunting as a skill to develop alongside coding.
## 【Reading Tips】
- **Skim Chapters 1–2 if you already know the mobile market**: The technology comparison and Xamarin history are useful context but not actionable. Jump to Chapter 3 for environment setup if you're eager to start coding.
- **Deep-read the C# crash course (Chapter 4) if you're new to programming**: This is the steepest learning curve. Work through every example in Visual Studio rather than just reading—the book assumes hands-on practice.
- **Pay special attention to Chapter 5's project structure explanations**: Understanding how Xamarin.Android, Xamarin.iOS, and Xamarin.Forms projects differ will save you hours of confusion later. The manifest and provisioning profile sections are easy to skim but critical for real deployment.
- **Use the layout chapters (6–8) as reference material**: You don't need to memorize every layout property. Instead, understand which layout solves which problem (Stack for linear, Grid for tabular, Flex for wrapping, Absolute for precise positioning) and return when you need specifics.
- **Skip the job-hunting chapter if you're purely technical**: It's valuable but comes last. If you're already employed or not job-seeking, the technical chapters 3–13 are where your time is best spent.
## 【Coverage Limits】
This guide covers the book's progression from setup through UI development and career advice. Excerpts do not cover the later chapters on data binding, SQLite, web services, native API access, or the detailed LinkedIn strategies—these are summarized from the table of contents but not detailed in the source material.
##
Passage locations
Page 10
how it is something to do only when the Xamarin and Xamarin.Essentials codebases do not have something that works cross- platform. It also describes how to i...
View in text
Excerpt 2
n.Forms is a development platform that allows for targeting multiple systems like iOS, Android, and UWP from a single, shared C# codebase. Points to remember...
View in text
Excerpt 3
ble percentage) { return inputValue / 100 * percentage; } } Static classes are usually defined to implement general-purpose members. They do not need a const...
View in text
Excerpt 4
s and views will be discussed in the upcoming chapters; for now, you just need to focus on how XAML allows for defining the user Objectives After completing...
View in text
Recommended for You
{{#thumbnailUrl}}
{{/thumbnailUrl}}
{{^thumbnailUrl}}
{{/thumbnailUrl}}
Loading recommended books...
Failed to load, please try again later
Tip the Site
Scan the WeChat Pay or Alipay code to tip. No login required.
WeChat Pay
Alipay