[英]Xamarin Pass Data Between Activity
I can not share data between 2 activity: 我无法在2个活动之间共享数据:
Activity1 活动1
homeButton.Click += delegate {
var second = new Intent(this, typeof(SecondPage));
second.PutExtra("reg", "qwe");
StartActivity (typeof(SecondPage));
}
Acitvity2(SecondPage) Acitvity2(第二页)
string txt = Intent.GetStringExtra ("reg") ?? "null";
Console.WriteLine (txt);
Still get null, any suggestions? 还是会得到null,有什么建议吗?
For a start, you should pass the intent you created: 首先,您应该传递您创建的意图:
homeButton.Click += delegate {
var second = new Intent(this, typeof(SecondPage));
second.PutExtra("reg", "qwe");
StartActivity (second);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.