0
将数据通过Intent从1个活动传递到另一个活动时,我得到空值。将数据通过意图传递给另一个活动时获取空值
从1Activity传球:
int s = position;
String str=adapter.getId(position);
int Type=DeviceType;
Bundle bunch=new Bundle();
bunch.putString("id", str);
bunch.putInt("DeviceType",Type);
bunch.putInt("position", s);
Intent It=new Intent();
It.setClass(PYSActivity.this,GridImages.class);
It.putExtras(bunch);
startActivity(It);
Retriveing在这里2活动:
super.onCreate(savedInstanceState);
setContentView(R.layout.main1);
Bundle b = this.getIntent().getExtras();
AppID=b.getString("id");
DeviceType=b.getInt("DeviceType");
Position=b.getInt("position");
list=(GridView)findViewById(R.id.list);
adapter1=new LazyAdapter1(this,mStrings,like,Rate,Id,img);
list.setAdapter(adapter1);
然后在检索 – 2012-02-24 06:47:00
我已经使用,INT ID = getIntent()。 。getExtras()getInt( “ID”);尽管得到nullvalue – 2012-02-24 06:54:27
您的检索方法是好的,它应该工作。 – Altaf 2012-02-24 07:40:40