问题遇到的现象和发生背景
官方文档里,只找见了分享出去的方法,却没有找见接收分享的方法。
下面的代码是搜出来拼凑的,完成了接受。
但是接收的这个Activity页面是空白的
问题相关代码,请勿粘贴截图
namespace MyApp
{
[Activity( Label = "MyShare")]
[IntentFilter(new[] { Intent.ActionSend },
Categories = new[] { Intent.CategoryDefault},
DataMimeType = "image/*")]
public class ContextRegistering_ : Activity
{
private AlertDialog dialog;
protected override void OnResume()
{
base.OnResume();
object obj = Intent.GetParcelableExtra(Intent.ExtraStream);
Stream stream = ContentResolver.OpenInputStream((Android.Net.Uri)obj);
long l = stream.Length;
AlertDialog.Builder builder = new AlertDialog.Builder(this);
dialog = builder.Create();
dialog.SetTitle(Intent.Type + l.ToString());
dialog.Show();
}
}
我的解答思路和尝试过的方法
试着用SetContentView();网上的参数R.layout.main或者Resource.Layout.Main都不行。