From ef01d3965535f1a3effb3dcaf50ffab221824ad4 Mon Sep 17 00:00:00 2001 From: Jonathan Pryor Date: Thu, 21 May 2015 20:06:18 -0400 Subject: [PATCH] Don't use string constants for class names. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This allows the SimpleWidget sample to run as expected when built with Xamarin.Android 5.0+. Strings containing type names are bad. They break refactoring. They also cause things to break when we change the names of the generated Android Callable Wrappers: http://developer.xamarin.com/releases/android/xamarin.android_5/xamarin.android_5.1/#Android_Callable_Wrapper_Naming As is often the case, Don't Do Thatâ„¢. Specifically, work *with* type system, and use actual types instead of strings. --- SimpleWidget/UpdateService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SimpleWidget/UpdateService.cs b/SimpleWidget/UpdateService.cs index 3f0cb0efd..bfe563654 100644 --- a/SimpleWidget/UpdateService.cs +++ b/SimpleWidget/UpdateService.cs @@ -32,7 +32,7 @@ public override void OnStart (Intent intent, int startId) RemoteViews updateViews = buildUpdate (this); // Push update for this widget to the home screen - ComponentName thisWidget = new ComponentName (this, "simplewidget.WordWidget"); + ComponentName thisWidget = new ComponentName (this, Java.Lang.Class.FromType (typeof (WordWidget)).Name); AppWidgetManager manager = AppWidgetManager.GetInstance (this); manager.UpdateAppWidget (thisWidget, updateViews); }