Xamarin.Forms: Start an activity using DependencyService

人走茶凉 提交于 2019-12-11 04:33:47

问题


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(){}


来源:https://stackoverflow.com/questions/28874892/xamarin-forms-start-an-activity-using-dependencyservice

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!