Skip to content

Commit

Permalink
Don't use string constants for class names.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jonpryor committed May 22, 2015
1 parent cfd7d24 commit ef01d39
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion SimpleWidget/UpdateService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit ef01d39

Please sign in to comment.