I just upgraded to Mono for Android version 4.2. Since then I am getting an error when trying to call SetRequestedOrientation from an Activity. Just get an error that says it does not exist in the current context. I was using v4.0 and this was working fine.
Just wondering if anyone else is having this issue since upgrading or if you know of a fix. Thanks.
This code used to work fine.
using System;
using Android.App;
using Android.Content.PM;
using Android.OS;
namespace AndroidApplication1
{
[Activity(Label = "AndroidApplication1")]
public class Activity1 : Activity
{
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
SetRequestedOrientation(ScreenOrientation.Portrait);
}
}
}
That’s exposed through the
RequestedOrientationproperty.