C# 结束活动时,将产品保存在篮子中

C# 结束活动时,将产品保存在篮子中,c#,android,xamarin,mono,C#,Android,Xamarin,Mono,当我从产品列表中添加产品时,我有篮子活动 添加属性的代码 add.Click += delegate { var intent = new Intent (this, typeof(CartActivity)); intent.PutExtra ("title", (string)(firstitem ["post_title"])); intent.PutExtra ("price", (string)(firstitem ["price"] +

当我从产品列表中添加产品时,我有篮子活动

添加属性的代码

add.Click += delegate {
        var intent = new Intent (this, typeof(CartActivity));
        intent.PutExtra ("title", (string)(firstitem ["post_title"]));
        intent.PutExtra ("price", (string)(firstitem ["price"] + " грн"));
        intent.PutExtra ("weight", (string)(firstitem ["weight"] + "г"));
        StartActivity (intent);
    };
productname.Text = Intent.GetStringExtra("title");
    price.Text = Intent.GetStringExtra("price");
    weight.Text = Intent.GetStringExtra("weight");
接收属性代码

add.Click += delegate {
        var intent = new Intent (this, typeof(CartActivity));
        intent.PutExtra ("title", (string)(firstitem ["post_title"]));
        intent.PutExtra ("price", (string)(firstitem ["price"] + " грн"));
        intent.PutExtra ("weight", (string)(firstitem ["weight"] + "г"));
        StartActivity (intent);
    };
productname.Text = Intent.GetStringExtra("title");
    price.Text = Intent.GetStringExtra("price");
    weight.Text = Intent.GetStringExtra("weight");
我试着停下来

namespace MurakamiKiev
{
[Activity(Label = "Murakami",  Icon = "@drawable/logo", Theme = "@android:style/Theme.Black.NoTitleBar", ScreenOrientation = ScreenOrientation.Portrait)]
public class CartActivity : Activity
{
    protected override void OnPause()
    {
        base.OnPause();

但当我运行“活动”时,我出现了黑屏

您是否在OnCreate()中调用了SetContentView()

像这样

namespace MurakamiKiev
{
    [Activity(Label = "Murakami",  Icon = "@drawable/logo", Theme = "@android:style/Theme.Black.NoTitleBar", ScreenOrientation = ScreenOrientation.Portrait)]
    public class CartActivity : Activity
    {
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.YourLayout);
        }
    }
}
可能重复的