Uri.Parse 已弃用

Uri.Parse deprecated

我有一个条形码扫描仪应用程序。我正在尝试扫描条形码并在 google 进行搜索。但是当我尝试按照 here 进行搜索时,它显示 Uri.Parse() 已弃用 。我找不到任何有用的东西,Uri 文档也没有说明任何相关内容。

Uri 文档

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

是否有其他选择或替代方案?

您正在引用 System 中的 Uri,其中 ParseObsolete:

[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);