Xamarin.Forms: Start an activity using DependencyS

2019-09-03 15:11发布

问题:

In my Xamarin.Forms.Page I have a DependencyService that must activate an activity in my .Droid project. How do I activate the Activity? I've tried

StartActivity(typeof(FacebookActivity));

but I get

Java.Lang.NullPointerException: Exception of type 'Java.Lang.NullPointerException' was thrown.

What do I have to initialize?

回答1:

Found out the problem. I have to put an explicit constructor

public FacebookActivity(){}