我对android编程很陌生..我有这个问题..我想传递一个值,但结果为null..我想知道为什么会这样..有人可以帮助我吗?提前致谢。我的代码是这样的..
管理器.java
String prize="5";
Intent i = new Intent(Manager.this, Shop.class);
i.putExtra("Key", prize);
startActivity(i);
商店.java
Intent myIntent = getIntent();
String receive = myIntent.getStringExtra("Key");
if (getIntent().getExtras() != null)
{
TextView tv = (TextView)findViewById(R.id.textView2);
tv.setText(receive);
}
else
{
TextView tv = (TextView)findViewById(R.id.textView2);
tv.setText("value is null"); //this is always the result
//why is it null??
}