当我从产品列表中添加产品时,我有篮子活动。
添加属性的代码
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");
我试过OnPause
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();
但是当我运行活动时,我有黑屏
答案 0 :(得分:0)
您是否在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);
}
}
}