活动期间Xamarin传递数据 [英] Xamarin Pass Data Between Activity

查看:225
本文介绍了活动期间Xamarin传递数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不能共享2活动之间的数据:

I can not share data between 2 activity:

活动1

homeButton.Click += delegate {
    var second = new Intent(this, typeof(SecondPage));
    second.PutExtra("reg", "qwe");
    StartActivity (typeof(SecondPage));
    }

Acitvity2(SecondPage)

Acitvity2(SecondPage)

string txt = Intent.GetStringExtra ("reg") ?? "null";

Console.WriteLine (txt);

不过得到空,有什么建​​议?

Still get null, any suggestions?

推荐答案

首先,你应该通过您创建的意图:

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);
    }

这篇关于活动期间Xamarin传递数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆