开发者

Not getting the Bundle value

开发者 https://www.devze.com 2023-03-30 04:07 出处:网络
Iam facing the problem while recieving the data through Bundle.. Intent toAudio = new Intent(TourDescription.this, Audio.class);

Iam facing the problem while recieving the data through Bundle..

Intent toAudio = new Intent(TourDescription.this, Audio.class);

toAudio.putExtra("SIZE", arraypoi.size());

for(int i=0; i<arraypoi.size(); i++)
      toAudio.putExtra("POI"+i, arraypoi.开发者_开发百科get(i));
startActivity(toAudio);

In the recieving class I have,

Bundle data = getIntent().getExtras();

int size=data.getInt("SIZE");

for(int i=0;i<size;i++)
    listOfPOI.add((PointOfIntrest) data.getParcelable("POI"+i));// Iam getting the exception //here..PointOfIntrest is the class name here.. 

can anyone help me with this ?

Thanks, Keerthiraj


If your for loop is not working then you should make toAudio.putExtra("SIZE",arraypoi.size()); to toAudio.putInt("SIZE", arraypoi.size());. Hope it will work.

0

精彩评论

暂无评论...
验证码 换一张
取 消