imageswitcher 로 사진보기를 만들었는데요.
밑에는 gally로 목록을 생성했고요 위에는 imageswitcher로 사진을 띄웠어요.
사진들은 frame으로 묶어주었고요.. gallay에서 클릭할경우 화면이 바뀌는 형식으로.
제가 imgaeswitcher로 뜬 사진을 클릭하면 그사진을 다른 클래스로 넘겨주고 싶은데 어떻게 해야하나요?
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.picture);
mSwitcher = (ImageSwitcher) findViewById(R.id.ImageSwitcher01);
mSwitcher.setFactory(this);
mSwitcher.setInAnimation(AnimationUtils.loadAnimation(this,
android.R.anim.fade_in));
mSwitcher.setOutAnimation(AnimationUtils.loadAnimation(this,
android.R.anim.fade_out));
Gallery g = (Gallery) findViewById(R.id.Gallery01);
g.setAdapter(new ImageAdapter(this));
g.setOnItemSelectedListener(this);
OnClickListener mZoomListener1 = new OnClickListener() {
public void onClick(View v){
startActivity(new Intent(capture.this, captureex.class)); //클래스 이동 위치
overridePendingTransition(R.layout.zoomenter, R.layout.zoom_exit);
}
};
mSwitcher.setOnClickListener(mZoomListener1); // 이부분이 imageswitcher에 있는 사진을 클릭할 경우인데요.
//클래스를 넘겨주면서 사진도 같이 넘겨주고 싶어요
}
public void onItemSelected(AdapterView parent, View v, int position, long id) {
mSwitcher.setImageResource(mImageIds[position]);
}
public void onNothingSelected(AdapterView parent) {
}
public View makeView() {
ImageView i = new ImageView(this);
i.setBackgroundColor(0xFF000000);
i.setScaleType(ImageView.ScaleType.FIT_CENTER);
i.setLayoutParams(new ImageSwitcher.LayoutParams(LayoutParams.FILL_PARENT,
LayoutParams.FILL_PARENT));
return i;
}
private ImageSwitcher mSwitcher;
public class ImageAdapter extends BaseAdapter {
public ImageAdapter(Context c) {
mContext = c;
}
public int getCount() {
return mThumbIds.length;
}
public Object getItem(int position) {
return position;
}
public long getItemId(int position) {
return position;
}
public View getView(int position, View convertView, ViewGroup parent) {
ImageView i = new ImageView(mContext);
i.setImageResource(mThumbIds[position]);
i.setAdjustViewBounds(true);
i.setLayoutParams(new Gallery.LayoutParams(
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
i.setBackgroundResource(R.drawable.picture_frame);
return i;
}
private Context mContext;
}
private Integer[] mThumbIds = {
R.drawable.sample_thumb_1, R.drawable.jelly, R.drawable.koal,
R.drawable.sample_thumb_2, R.drawable.sample_thumb_3,
R.drawable.sample_thumb_4, R.drawable.sample_thumb_5};
private Integer[] mImageIds = {
R.drawable.sample_1, R.drawable.jelly, R.drawable.koal, R.drawable.sample_2,
R.drawable.sample_3, R.drawable.sample_4, R.drawable.sample_5};