Reputation: 241
So far, I've been unsuccessful at finding anything on this that has worked. I'm trying to change the current view from a class in the .droid namespace to another in the same namespace.
Intent intent = new Intent(this, typeof(viewclass));
Is what seems to be half correct. The biggest problem is this as I cannot do that from the droid, I get the following error:
Cannot convert from App.Droid.CustomMapRenderer to Android.Context.Context
Solution:
var intent= new Intent(Android.App.Application.Context, typeof(ViewClass));
Android.App.Application.Context.StartActivity(intent);
Upvotes: 0
Views: 167
Reputation: 10841
The biggest problem is this as I cannot do that from the droid, I get the following error:
From the error message. You are creating an Intent inside a renderer(CustomMapRenderer
). Thus this
refers to an instance of CustomMapRenderer
, but to create an intent the first argument should be a Context
.
So to fix the problem, you need to retrieve the current context in certain way,
For example, you can try Intent intent = new Intent(Application.Context, typeof(viewclass));
Upvotes: 1