0
我正在使用意向從圖像庫發送到NextImage.java活動的選定圖像。我想將圖像的選定位置和圖像數組發送到下一個活動。我正在混淆意圖。意圖庫圖像android位置和arraylist
String[]imageUrls= new String[PostDetails.size()];
for (int index=0;index<imageUrls.length;index++){
imageUrls[index]=PostDetails.get(index).getImag();
}
gallery = (Gallery) findViewById(R.id.img_gallery);
gallery.setAdapter(new ImagePagerAdapter(imageUrls));
gallery.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> gallery, View view, int position, long id) {
Intent galleryIntent = new Intent(ImageGalleryActivity.this, MyNextImage.class);
galleryIntent.putExtra(imageUrls, position);
startActivity(galleryIntent);
}
在接下來的圖像類
:
private ViewPager pager;
String[] imageUrls;
private DisplayImageOptions options;
String images;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.view_flipper_item);
Bundle bundle = getIntent().getExtras();
String[] imageUrls = bundle.getStringArray(images);
int pagerPosition = bundle.getInt(position, 0);