3
와 "공유"메뉴에 응용 프로그램을 추가하는 방법 : http://twigstechtips.blogspot.com/2011/10/android-sharing-images-or-files-through.html내 솔루션이 문서를 기반으로 monodroid
와 "공유"메뉴에 응용 프로그램을 추가하는 방법 : http://twigstechtips.blogspot.com/2011/10/android-sharing-images-or-files-through.html내 솔루션이 문서를 기반으로 monodroid
당신은 당신의 클래스 선언하기 전에
[IntentFilter(new[]{Intent.ActionSend},Categories = new[]{Intent.CategoryDefault},DataMimeType = "image/*",Label = "Your application name")]
을 추가해야합니다. 좋아요 :
[Activity(Label = "Activity label", ScreenOrientation = ScreenOrientation.Portrait)]
[IntentFilter(new[]{Intent.ActionSend},Categories = new[]{Intent.CategoryDefault},DataMimeType = "image/*",Label = "Your application name")]
public class YourActivity: Activity
{
protected override void OnCreate(Bundle savedInstanceState)
{
if (Intent.Action == Intent.ActionSend && Intent.Extras.ContainsKey(Intent.ExtraStream))
{
var fileUrl = GetFilePath((Android.Net.Uri)Intent.Extras.GetParcelable(Intent.ExtraStream));
}
}
private string GetFilePath(Android.Net.Uri uri)
{
string[] proj = {MediaStore.Images.ImageColumns.Data};
var cursor = ManagedQuery(uri, proj, null, null, null);
var colIndex = cursor.GetColumnIndex(MediaStore.Images.ImageColumns.Data);
cursor.MoveToFirst();
return cursor.GetString(colIndex);
}
}
감사합니다. 이것은 나를 많이 도와 줘요! – davidlebr1
Welcome @ Dave.Lebr1 :) – Roosevelt