Как мне найти текст, который будет доступен через список параметров общего доступа, который есть в Android?
Это мой код, который я использую. Я в основном делюсь текстом с моим приложением, выбрав текст, например, из Google, затем щелкните правой кнопкой мыши по нему и нажмите «Поделиться», и я выберу свое приложение там. Функция обмена работает отлично, но я хочу получить фактический текст в моем коде, которым я пытаюсь поделиться!
[Activity(Label = "TextRecieve", Icon = "@drawable/ic_home", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
[IntentFilter(new[] { Intent.ActionSend }, Categories = new[] { Intent.CategoryDefault }, DataMimeType = "image/*", Label = "TextRecieve")]
[IntentFilter(new[] { Intent.ActionSend }, Categories = new[] { Intent.CategoryDefault }, DataMimeType = "text/plain", Label = "TextRecieve")]
[IntentFilter(new[] { Intent.ActionSendMultiple }, Categories = new[] { Intent.CategoryDefault }, DataMimeType = "image/*", Label = "TextRecieve")]
Intent intent = Intent;
String action = Intent.Action;
String type = intent.Type;
if (Intent.ActionSend.Equals(action) && type != null)
{
if ("text/plain".Equals(type))
{
// Handle text being sent
// ...
// ...
// ...
}
else if (type.StartsWith("image/"))
{
// Handle single image being sent
// ...
// ...
// ...
}
}
else if (Intent.ActionSendMultiple.Equals(action) && type != null)
{
if (type.StartsWith("image/"))
{
// Handle multiple images being sent
// ...
// ...
// ...
}
}
else
{
// Handle other intents, such as being started from the home screen
}