URI.Parse已弃用

6
我有一个条形码扫描应用程序。 我试图扫描条形码并在谷歌上搜索。 但是当我尝试按照这里所述搜索时,它会显示Uri.Parse()已被弃用。 我找不到任何有用的信息,并且Uri文档中也没有说明。 Uri文档

https://developer.android.com/reference/android/net/Uri.html

还有其他选项或替代品吗?


为什么我在这里被踩了?我很困惑。 - Pareidolia
我的Android Studio没有这样说(正如您注意到的文档也没有提到),所以您可以忘记它(并责怪Visual Studio)。 - pskink
1个回答

20

您正在引用System中的Uri,其中Parse已被标记为Obsolete

[ObsoleteAttribute("The method has been deprecated. It is not used by the system.
protected virtual void Parse()

你所提到的SO问题正在使用来自Android.Net命名空间的Uri

Android.Net.Uri uri = Android.Net.Uri.Parse("http://www.google.com/#q=fish");
var intent = new Intent(Intent.ActionView, uri);
StartActivity(intent);

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接