May 8, 2015

Android Tips: Hello AppCompatActivity, Goodbye ActionBarActivity

By

With the latest updates to the Android Support v7 AppCompat Library, revision 22.1, integrating Google’s Material Design has never been easier. ToolbarIf you need to get caught up with AppCompat, we have already covered how to add Material Theming to your apps with AppCompat and how to replace your ActionBar with the new advanced Toolbar in previous posts. With revision 22.1, Google has made some drastic positive changes to the API.

Getting Started

It’s easy to get started with the Support v7 AppCompat library by simply installing the NuGet through the NuGet package manager in Visual Studio or Xamarin Studio.

AppCompatNuGets

After you have the latest NuGet packages installed, you will want to ensure that you properly configure your theme by following this guide.

Introducing AppCompatActivity

ActionBarActivity was originally introduced years ago to bring ActionBar support to pre-Android 3.0 devices. However, as Android advances and the AppCompat library continues to grow, changes must be made. If you were using older versions of the support libraries, once you have upgraded your NuGet packages and build, you will now see that ActionBarActivity has been deprecated. It has been replaced with AppCompatActivity, which will be used to cover the full scope of everything that is in AppCompat.

public class MainActivity : AppCompatActivity
{
}

It may seem like just a name change, but you now have access to the internal logic of AppCompat by using AppCompatDelegate enabling any Activity to hook into lifecycle methods, theming, color tinting, and more if you want to just use Activity. However, the easiest way to ensure forward and backwards compatibility is to simply use AppCompatActivity.

Beautiful Dialogs

One of my favorite features of revision 22.1 of AppCompat has to be Support AlertDialog. This support AlertDialog brings Material Design to all of your alert dialogs with a simple name change. Previously, to open a dialog you may have used the following code:

var builder = new AlertDialog.Builder (this);
builder.SetTitle ("Hello Dialog")
       .SetMessage ("Is this material design?")
       .SetPositiveButton ("Yes", delegate { Console.WriteLine("Yes"); })
       .SetNegativeButton ("No", delegate { Console.WriteLine("No"); });
builder.Create().Show ();

Now, you can replace AlertDialog with Android.Support.V7.App.AlertDialog or add the following statement at the top to make your dialog shine.

using AlertDialog = Android.Support.V7.App.AlertDialog;

Here is the before and after:

Support Alert Dialogs

Important Updates

You should also be aware of a few important changes to theme attributes in revision 22.1.

Updates to Theme

When you setup your custom theme inside of values/styles.xml there are several attributes that you can use to specify your color palette and use of the toolbar. Yours may look similar to this:

<resources>
  <style name="MyTheme" parent="MyTheme.Base">
  </style>
  <style name="MyTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
    <item name="android:windowNoTitle">true</item>
    <item name="windowActionBar">false</item>
    <item name="colorPrimary">#2196F3</item>
    <item name="colorPrimaryDark">#1976D2</item>
    <item name="colorAccent">#FF4081</item>
  </style>
</resources>

One of these attributes is not like the others. As you can see android:windowNoTitle has the “android:” prefix, however in revision 22.1 this has been corrected so your theme simply reads:

<resources>
  <style name="MyTheme" parent="MyTheme.Base">
  </style>
  <style name="MyTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
    <item name="windowNoTitle">true</item>
    <item name="windowActionBar">false</item>
    <item name="colorPrimary">#2196F3</item>
    <item name="colorPrimaryDark">#1976D2</item>
    <item name="colorAccent">#FF4081</item>
  </style>
</resources>

Updates to Toolbar

Similar to the theme, the support toolbar has also received a few updates to its XML. Previously, you needed to add a local namespace xmlns, but this is no longer needed and you can create the toolbar with the following code:

<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/toolbar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:minHeight="?attr/actionBarSize"
    android:background="?attr/colorPrimary"
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
    android:popupTheme="@style/ThemeOverlay.AppCompat.Light" />

So Much More

I have only touched on revision 22.1 of AppCompat in this post, however the other Support Libraries including Support v4, Leanback, RecyclerView, and Palette have also received updates. These include several enhancements such as drawable tinting, animation interpolators, SortedList for RecyclerView, and drastic speed improvements to Palette. Be sure to read through the official Android developer blog for all of the latest details.

Tweet about this on TwitterShare on FacebookShare on Google+Share on LinkedInEmail this to someone
May 7, 2015

Champion San Jose Earthquakes Win with Xamarin.Forms and Xamarin Insights

By

San Jose Earthquakes LogoAvaya Stadium, home to the two-time MLS Cup Champion San Jose Earthquakes, is widely considered to be the best soccer stadium in the U.S. Selected to create a premium app for the new stadium, Xamarin Premier Consulting Partner ArcTouch needed a cross-platform solution to provide an app that would be fun and engaging on game day, and enable the Quakes’ fervent fan base to interact with the team at any time, from anywhere.

With just four months to produce an app for iOS and Android, ArcTouch turned to Xamarin.Forms for fast, cost-effective app development.

“By utilizing Xamarin.Forms we were able to share 100% of the business logic, and 80% of the UI code across all platforms,” says Adam Fingerman, Founder and Chief Experience Officer at ArcTouch.

San Jose Earthquakes AppThe powerful app provides several key features for the Earthquakes’ fans, including the ability to buy tickets, browse player bios, and connect to the team on social media. The app also helps fans navigate to and within the stadium with driving directions, FAQs, and an interactive map of amenities.

ArcTouch also used Xamarin Insights with the app, which enabled them to find and fix an issue that affected 3% of Android users within 48 hours. They were so impressed with this capability that they now offer Xamarin Insights with all of their mobile apps.

“Without Xamarin Insights, it would have taken much longer for us to identify the problem and caused a lot more user frustration,” says Fingerman. “The early warning spared us a lot of angst.”

Ultimately, the San Jose Earthquakes were thrilled with the resulting app and all of it’s leading edge features, including the ability to easily update in-app content without publishing a new app version and scan attendees into the stadium through the app instead of using paper tickets.

“We’ve spent the last three years building a state-of-the-art stadium, laboring over every detail to provide a fan experience that rivals any other in the world and the app is a critical piece,” says Earthquakes president Dave Kaval. “ArcTouch scored big for us. The result is a truly engaging app we think our fans will love.”
 

View the Case Study
 

Tweet about this on TwitterShare on FacebookShare on Google+Share on LinkedInEmail this to someone
May 5, 2015

Build 2015: Visual Studio Integration & Developer Celebrations

By

In addition to achieving the 1 Million developer milestone last week, Xamarin developers also enjoyed a great show at Microsoft Build 2015, with a packed attendee party on opening night, multiple sessions covering mobile development with Xamarin, and the debut of Microsoft’s Visual Studio 2015 Release Candidate with improved Xamarin integration.

Kicking Off Build 2015 with Xamarin

We kicked off Build 2015 in a big way at Jillian’s in San Francisco on April 28th. With over 1,400 attendees and Charles Petzold in attendance signing copies of his Xamarin.Forms book preview, this was our biggest and best Xamarin Build party yet! It was inspiring to see the flood of Xamarin shirts at Build, and exciting to make our three Developer Rig Giveaway contest winners happy.

Xamarin's Microsoft Build 2015 Kick Off Party

One of the most popular features of the night was the Xamarin Test Cloud Wall that showed automated testing on 60 devices—just a fraction of the number of devices most teams need to test on to ensure a high quality user experience.  If you couldn’t make it to Build to see Xamarin Test Cloud in action in person, you can check our new Xamarin Test Cloud overview video out our freshly updated Xamarin Test Cloud page.

Xamarin Test Cloud Wall

Xamarin Integration in Visual Studio 2015

Becoming a Xamarin developer couldn’t be easier with the release of Visual Studio 2015 RC. During the Visual Studio 2015 installation process, you can now choose to install Xamarin and its requirements with a single click, giving you everything you need to get started with native, cross-platform development in C# with Xamarin.

Visual Studio Install with Xamarin

Starter Edition in Visual Studio

Along with an integrated installation experience, our free developer tier, Xamarin Starter Edition now works with Visual Studio. This lets anyone get a taste of mobile development in C# by giving you the ability to write small apps which can be deployed to devices and published to app stores.

These new enhancements to our support for Visual Studio are a great compliment to what we announced with our 1 million developer download milestone — expanded support for Xamarin.Forms for Windows, and WatchKit design and development support in Visual Studio.

Session Recordings

If you weren’t able to attend this year’s Build conference don’t worry — you can experience the magic of Miguel de Icaza and James Montemagno’s session on how to Go Mobile with C#, Visual Studio, and Xamarin online now.

In addition, James Montemagno delivered an additional session at Build focused on Developing Multi-Device Apps with Xamarin and Office 365 APIs that is also available online.

See You at Ignite

If you are in Chicago this week for Microsoft Ignite, we’re at booth #216, so be sure to stop by and say hello. Additionally, Xamarin Developer Evangelist, James Montemagno will be delivering two sessions this year:

 

Tweet about this on TwitterShare on FacebookShare on Google+Share on LinkedInEmail this to someone
May 4, 2015

Xamarin Events Happening in May

By

It’s conference season again and May is the perfect time to catch a Xamarin event near you! Here is a list of a few events happening around the world you won’t want to miss.

May 2015 Meetups Banner

Microsoft Ignite us

  • Chicago, IL: May 5th – 8th
  • Go Mobile with C#, Visual Studio, and Xamarin by James Montemagno

Xamarin Dev Days – Chicago us

  • Chicago, IL: May 9th
  • Bringing mobile development with Xamarin to Chicago

Software Design & Development uk

  • London, England: May 11th – 15th
  • Cross-Platform Mobile Development with Xamarin by Mark Smith

Techorama Belgium

  • Mechelen, Belgium: May 13th
  • Go Mobile with C#, Visual Studio, and Xamarin by Mike James

Chicago Coder Conference us

  • Chicago, IL: May 14th – 15th
  • Xamarin.Forms: Native iOS, Android, and Windows Phone apps from ONE C# Codebase by James Montemagno

Xamarin Dev Days – Mountain View us

  • Mountain View, CA: May 17th
  • Bringing mobile development with Xamarin to the Bay Area

DEVIntersection us

  • Phoenix, AZ: May 18th – 21st
  • Integrating Office 365 APIs into Multi-Device Mobile Applications by James Montemagno

Twilio Signal us

  • San Francisco, CA: May 19th – 20th
  • C# and Twilio-Powered iOS and Android Experiences by James Montemagno

Xamarin Dev Days – Phoenix us

  • Phoenix, AZ: May 23rd
  • Bringing mobile development with Xamarin to Phoenix

Xamarin Dev Days – Houston us

  • Houston, TX: May 30th
  • Bringing mobile development with Xamarin to Houston

Xamarin Dev Days – Austin us

  • Austin, TX: May 31st
  • Bringing mobile development with Xamarin to Austin

 

Look to the Events Forum for even more upcoming Xamarin events, meetups, and presentations happening this month near you!

Interested in getting a developer group started? We’re here to help! Here’s a tips and tricks guide on staring a developer group, an introduction to Xamarin slide deck, and of course our community sponsorship program to get you on your way. Also, we love to hear from you, so feel free to send us an email or tweet @XamarinEvents to help spread the word and continue to grow the Xamarin community.

Tweet about this on TwitterShare on FacebookShare on Google+Share on LinkedInEmail this to someone
May 1, 2015

Developer Rig Giveaway Winners

By

After 913 submissions from 485 entrants, we’re happy to announce the randomly selected winners of our Build 2015 developer rig contest!

Build 2015 Xamarin Developer Rig Winners

The winning tweets were:

Cameron VetterCameron Vetter from Wisconsin, USA: @xamarinhq I’m standing in line for the keynote at #bldwin thanks for the great year of mobile development
 
 
 
 
 
 
Thimo BuchheisterThimo Buchheister from Germany: Now waiting to meet Alex from Xamarin partner program – still wearing my Xamarin Shirt ;-) @xamarinhq #bldwin
 
 
 
Robb SchieferRobb Schiefer from Alabama, USA: Selfie @bldwin in my @xamarinhq tshirt #azure #build2015 #visualstudio
 
 
 
 
 
Congratulations to our three winners, and a big thank you to everyone who participated in the contest – we loved seeing all of your submissions!

Tweet about this on TwitterShare on FacebookShare on Google+Share on LinkedInEmail this to someone
April 29, 2015

Xamarin Passes 1 Million Developer Milestone

By

Today we announced that over 1 million unique developers have downloaded Xamarin since we started shipping C# for iOS and Android in July 2011. In addition to passing this major milestone, we are excited to announce some amazing new features that you can get today.

Xamarin reaches 1 million downloads

Xamarin.Forms for Windows

Xamarin.Forms for Windows 8.1 and Windows Phone 8.1

This March, we released Xamarin.Forms for Windows and Windows Phone Preview with a very positive response from developers. Today, we are pleased to announce the general availability of support for these platforms, enabling developers to build and ship Xamarin.Forms apps targeting all of the major mobile platforms from a single code base. Xamarin.Forms for Windows and Windows.Phone will be available to install via NuGet later today.

Hanselman.Forms on All Devices

Availability of Private Previews of Xamarin.Forms for Windows 10 UAP

In addition to the stable release of Windows 8.1 and Windows Phone 8.1, we’re also announcing the start of a private preview of Xamarin.Forms for the Windows 10 Universal App Platform, enabling developers that build apps for all Windows platforms to share even more code. This is a very early preview and we’ll be making the Xamarin.Forms for Windows 10 pre-release packages available to small batches of developers over the coming weeks. If you’re interested in joining our preview program, please sign up here.

New Visual Studio Features

Code Completion for Xamarin.Forms XAML

Declarative UI development in Visual Studio gets even more powerful with code completion for Xamarin.Forms. Now you can easily explore Xamarin.Forms user interface APIs, quickly build complex screens, and avoid typos and other common mistakes while creating UIs in XAML.

XamlCodeCompletion

Microsoft Visual C++ Debugger Integration

We’ve worked with the Visual C++ team at Microsoft to make it easy to reference and debug C++ libraries in Xamarin.Android apps. In the Visual Studio 2015 Release Candidate, you will now find a new option to pick which debugger you would like to use when running your Xamarin.Android apps from the project’s property window. Simply choose Microsoft and you will be able to debug through your native C++ library with all of the debug features you know and love, including expression evaluation, watch window, and auto window.
DebugCppAndroid

Enhanced WatchKit Support

Our iOS designer in Visual Studio is now fully enabled for editing Apple Watch storyboards. Drag interface controllers and UI controls onto the storyboard from the Visual Studio Toolbox and configure properties on the Properties pad and use control + drag to move buttons, tables, or interface controllers onto another interface controller to create segues.watchdesigner-vs

iOS Binding Projects

When developing iOS projects in Visual Studio, you might encounter cases where you want to consume a third-party Objective-C library. In those situations, you can now use Xamarin.iOS Binding Projects in Visual Studio to create a C# binding that will allow you to consume the library in your Xamarin.iOS apps.

Get Started With Xamarin Today

Join over 1 million developers by downloading your free trial of Xamarin to build native iOS, Android, Mac, and Windows apps today. Then, head over to our developer portal where you’ll find samples, documentation, and upcoming events to help you get started with Xamarin.

Tweet about this on TwitterShare on FacebookShare on Google+Share on LinkedInEmail this to someone
April 28, 2015

Delivering High Quality Apps with Every Submission

By

Have you ever uploaded an app for review and had it rejected? Or worse, fail in the hands of users? The former can cause delays to shipping your newest release and the latter can taint an otherwise great brand.

Rejection

I have personally experience a slew of these issues with the several apps I’ve published. Most recently, I had an app review failure when attempting to prepare Dutch Spelling for release. I manually tested the app on my local devices (an iPhone 5s and an iPhone 4) where it looked fantastic and ran without any issues. I was ready to upload it to the app store for review, as I thought it was ready for publishing, but apparently it wasn’t! I hadn’t tested the app on any newer devices or outside of my development devices. Having released a version of Dutch Spelling a few years ago that crashed on launch, and in turn learning all about Apple’s expedited review process, I wanted to make sure I didn’t have another case of “It works on my machine.”

An Easy Solution

I knew it was about time that I took testing seriously and stopped thinking of it as an afterthought to the development process. It’s easy to get carried away in the excitement of seeing the app run locally without any issues and forget that more device configurations exist in the wild. I could have purchased more devices to test on locally, but if I app want to target Android in the future, I would need 134 devices just to get coverage of the most popular devices in the US alone. This clearly wasn’t a scalable solution or a problem that’s easily tackled in-house. Instead, I opted to use Xamarin Test Cloud, where I knew I could run my app on every iOS device ever released. If I port the app to Android in the future, I’ll have the option of thoroughly testing on the huge array of constantly-updated devices available on the platform.

Getting Started

There are two parts to Xamarin Test Cloud, the local UITest authoring and the remote device cloud. I created the UITests locally and tested them within the iOS simulator, where everything seemed to work perfectly. At this point, it’s easy to assume that it’s ok to submit the app for review, but I still wanted to know if the app worked as expected across all devices.

Screen Shot 2015-04-28 at 18.23.25

My initial reaction to seeing the dashboard was one of elation, as it appeared on first glance that all the tests had passed as expected. However, on further inspection I could see that the custom views were being drawn incorrectly. I hadn’t accommodated for the differences in width between the iPhone 5 and the iPhone 6 (Plus). This is a fairly common issue for iOS developers at the moment as it has historically been very easy to use hardcoded position values when developing for iOS.

First TestCloud - Dutch Spelling

In order to save time and release the app as quickly as possible, I updated my custom controls to offset the position values based on the size of the screen. Although this isn’t a forever solution, it does allow me to submit the app and know it will look great on all iPhones. In the future, I’ll move the custom controls to Storyboards, which will make layouts much more flexible. Here’s an updated screenshot of how the devices looked after the update:

Screen Shot 2015-04-28 at 18.30.30

 

You can see the app now looks great across every device, no matter what the width, and I can rest assured that it works on devices outside of my office. Not only is Xamarin Test Cloud a fantastic way to find bugs in your apps before you ship them, but it doubles (as we’ve seen here) as a way to check how your app looks on different devices.

Learn more

If you’re interested in learning more about Xamarin Test Cloud features and how to get started, you can find lots of information in our developer center or request a demo from our team.

Tweet about this on TwitterShare on FacebookShare on Google+Share on LinkedInEmail this to someone
April 23, 2015

Lollipop Support comes to the Xamarin Android Player

By

Waiting for an emulator to boot or deploy is one of the most frustrating things about Android development. We built the Xamarin Android Player to provide a high-performance, hassle-free Android simulator, and to make Android development smooth and pleasant.

Introducing Lollipop Support

Starting today, when you launch the Xamarin Android Player you will see a brand new device image for Android 5.1 Lollipop enabling you to test against all of the latest Lollipop APIs with Material Design.

Xamarin Android Player Lollipop

Help us improve

We released our first preview in October of last year and thousands of Xamarin developers have already used it to build and test Android apps. We’ve collected a lot of feedback, and the experience has already improved a lot.

But we’re not done! Our goal is to install the Xamarin Android Player by default with Xamarin, and to replace the stock Google Android emulator with it. And we need your help. Please download the Xamarin Android Player today and give it a try. Report any issues that you find so that we can keep improving.

To learn more about the Xamarin Android Player, be sure to read the full documentation on how to get started.

Tweet about this on TwitterShare on FacebookShare on Google+Share on LinkedInEmail this to someone

Win a $10k Mobile Developer Rig from Xamarin at Build 2015

By

Wear the new Xamarin t-shirt from the Xamarin Build 2015 Kick Off Party to Build on April 29th for your chance to win one of three Mobile Developer Rigs worth over $10,000!

Xamarin Build 2015 Developer Rig Contest Prizes

How to Enter

Attend the Xamarin Build 2015 Kick Off Party on 4/28, where you’ll receive the newly designed Xamarin t-shirt. Wear the t-shirt from the Kick Off Party to Day One of Build on 4/29, and tweet a picture of yourself wearing it at the conference with @xamarinhq and #bldwin and/or #build2015 in the text. For example: “I’ve got @xamarinhq on my shirt and mobile development on my mind at #bldwin #build2015″. All entries must be received by 11:59 pm on 4/29.

A valid entry consists of a tweet with:

  • An image of yourself wearing the new Xamarin Build Kick Off Party t-shirt at Build on 4/29.
  • The hashtag(s) #bldwin and/or #build2015 and @xamarinhq.
  • You may enter multiple times, but each entry must contain a unique image and text.

If you haven’t registered for the Xamarin Build Kick Off Party yet, you can do so below:

 

The Prizes

Each of the three winners will receive a Xamarin Mobile Developer Rig, which will include the following:

Hardware

  • 15” Macbook Pro Laptop with Retina
    • 2.5 GHz i7 Processor
    • 16GB RAM
    • 512 GB SSD
    • Apple Magic Mouse
    • Apple wireless keyboard
  • Surface Pro 3
    • 1.7 GHz
    • 8 GB RAM
    • 512GB
    • Intel Core i7
  • Ultra high-resolution 4K Monitor

Phones

  • iPhone 6
  • The winner’s choice of an equivalent Android phone
  • Windows Phone

Tablets

  • iPad Air 2
  • The winner’s choice of an equivalent Android tablet

Smartwatches

  • Apple Watch
  • Microsoft Band
  • Moto 360

One-year Xamarin subscriptions

  • Xamarin.iOS Enterprise
  • Xamarin.Android Enterprise
  • Xamarin.Mac Enterprise
  • Xamarin Test Cloud Basic
  • Xamarin University

Rules and Regulations

All entries must be submitted by 11:59 pm PT on April 29, 2015. A valid entry is a tweet that contains an image of the submitter wearing the new Xamarin t-shirt from the Xamarin Build Kick Off Party on 4/28 at Build and includes both @xamarinhq and the hashtag(s) #bldwin and/or #build2015. We will select three winners at random from the submissions. Each entry must have a unique image and text. Contestants should follow @XamarinHQ to enable us to DM you for private follow-up if you win a prize. This contest is open to individuals and there is no purchase necessary to enter.

Tweet about this on TwitterShare on FacebookShare on Google+Share on LinkedInEmail this to someone
April 21, 2015

Join Xamarin at Microsoft Ignite 2015

By

Join Xamarin at Microsoft Ignite in Chicago, IL from May 4-7, 2015. Key members from the Xamarin team will be available to answer your questions, discuss your apps and projects, and show you what’s new across our products.

McCormick Sky Line

James Montemagno, Xamarin Developer Evangelist, will be delivering two talks this year:

  • Go Mobile with C#, Visual Studio, and Xamarin, Thursday, May 7th 10:45am-12:00pm: Learn how to leverage your existing Microsoft .NET and C# skills to create iOS and Android apps in Visual Studio with Xamarin and share your business logic across all platforms. During this session, James will cover several live coding samples and real-world mobile apps to look at the architecture and patterns that power them.
  • Building Multi-Device Applications with Xamarin and Office 365 APIs, Friday, May 8th 9:00-10:15am: This session will introduce the different approaches to building mobile apps that consume Office 365 platform services. The session will give an overview of both native Windows and Xamarin cross-platform development (Android, iOS, Windows Phone) using Visual Studio.

We’ll be at booth #216, so be sure to stop by and say hello if you’re at the conference — we look forward to seeing you in Chicago!

Tweet about this on TwitterShare on FacebookShare on Google+Share on LinkedInEmail this to someone