📜  xamarin 共享文本意图 - 任何代码示例

📅  最后修改于: 2022-03-11 14:58:04.445000             🧑  作者: Mango

代码示例1
public class CustomActions : ICustomActions
    {
        Context context = Android.App.Application.Context;

        public void ShareThisLink()
        {
            Intent sharingInt = new Intent(Android.Content.Intent.ActionSend);
            sharingInt.SetType("text/plain");
            string shareBody = "https://www.google.com";
            sharingInt.PutExtra(Android.Content.Intent.ExtraSubject, "Subject");
            sharingInt.PutExtra(Android.Content.Intent.ExtraText, shareBody);
            context.StartActivity(Intent.CreateChooser(sharingInt, "Share via"));
        }

    }