如何在 xamarin 中获取 ContactsContract.RawContacts.AGGREGATION_MODE_DISABLED 的值?
How to get the value of ContactsContract.RawContacts.AGGREGATION_MODE_DISABLED in xamarin?
我正在尝试以编程方式在 Xamarin.Android 中插入联系人。
我找到了这段 Java 代码并试图将其转换为 Xamarin C#
ArrayList<ContentProviderOperation> ops = new ArrayList<ContentProviderOperation>(); ops.add(ContentProviderOperation .newInsert(ContactsContract.RawContacts.CONTENT_URI) .withValue(ContactsContract.RawContacts.ACCOUNT_TYPE, null) .withValue(ContactsContract.RawContacts.ACCOUNT_NAME, null) .withValue(ContactsContract.RawContacts.AGGREGATION_MODE, ContactsContract.RawContacts.AGGREGATION_MODE_DISABLED).build());
通常与 RawContacts 常量的区别在于,在 Xamarin C# 中,常量使用 Pascal 大小写。 ACCOUNT_TYPE 和 ACCOUNT_NAME 在 RawContacts.InterfaceConsts.
里面
但我似乎无法在 Xamarin.Android 中找到 ContactsContract.RawContacts.AGGREGATION_MODE_DISABLED。我确实从 Java Android 文档中发现它的值为 3,但我不想对其进行硬编码。那么在Xamarin.Android中去哪里找到ContactsContract.RawContacts.AGGREGATION_MODE_DISABLED的值呢?
这对我有用
Android.Provider.AggregationMode.Disabled
我正在尝试以编程方式在 Xamarin.Android 中插入联系人。
我找到了这段 Java 代码并试图将其转换为 Xamarin C#
ArrayList<ContentProviderOperation> ops = new ArrayList<ContentProviderOperation>(); ops.add(ContentProviderOperation .newInsert(ContactsContract.RawContacts.CONTENT_URI) .withValue(ContactsContract.RawContacts.ACCOUNT_TYPE, null) .withValue(ContactsContract.RawContacts.ACCOUNT_NAME, null) .withValue(ContactsContract.RawContacts.AGGREGATION_MODE, ContactsContract.RawContacts.AGGREGATION_MODE_DISABLED).build());
通常与 RawContacts 常量的区别在于,在 Xamarin C# 中,常量使用 Pascal 大小写。 ACCOUNT_TYPE 和 ACCOUNT_NAME 在 RawContacts.InterfaceConsts.
里面但我似乎无法在 Xamarin.Android 中找到 ContactsContract.RawContacts.AGGREGATION_MODE_DISABLED。我确实从 Java Android 文档中发现它的值为 3,但我不想对其进行硬编码。那么在Xamarin.Android中去哪里找到ContactsContract.RawContacts.AGGREGATION_MODE_DISABLED的值呢?
这对我有用
Android.Provider.AggregationMode.Disabled