【androidベース】のintent伝達配列[activity間伝達ピクチャパラメータ等に適用]
activity
Bundle b=new Bundle(); b.putIntArray(key, new int[]{value1, value2}); Intent i=new Intent(context, Class); i.putExtras(b);
取得データが必要なactivityに追加
Bundle b=this.getIntent().getExtras(); String[] array=b.getIntArray(key);
:
public void myClick(View target) {
Intent intent;
switch (target.getId()) {
case R.id.mg1:
Bundle bundle = new Bundle();
bundle.putIntArray("mThumbIds", new int[]{R.drawable.mm1, R.drawable.mm2,R.drawable.mm3, R.drawable.mm4});
bundle.putIntArray("mImageIds", new int[]{R.drawable.mm1_thumb, R.drawable.mm2_thumb,R.drawable.mm3_thumb, R.drawable.mm4_thumb});
intent = new Intent(ImageListActivity.this, ImageSwitcherActivity.class);
intent.putExtras(bundle);
startActivity(intent);
break;
case R.id.mg2:
.........
:
this.mImageIds = this.getIntent().getExtras().getIntArray("mImageIds");
this.mThumbIds = this.getIntent().getExtras().getIntArray("mThumbIds");
onCreate ( , 。 )