아래의 소스코드는 커뮤니티에 있는  SDcard에 있는 이미지를 GalleryView로 보는 소스코드입니다.

이 코드를 잘 사용하고 있는데, 궁금한 점이 있습니다. galleryview에 나타난 이미지를 클릭한 다음,

다른 Activity에게 선택한 이미지의 Uri를 넘겨주려고 하느데요...어떻게 해야하나요....

마우스로 이미지를 클릭하고 나서 다음 Activity가 호출되게 하는 법을 모르겠습니다.

아래에 주석처리처럼 OnClickListener를 써도 안되네요....좀 도와주세요...ㅠㅠ

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
public class Photo extends Activity {

 @Override
 public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main);
     
  Gallery gallery = (Gallery) findViewById(R.id.gallery);
     
  Cursor c = getContentResolver().query(Images.Media.EXTERNAL_CONTENT_URI, null, null, null, null); //Image데이터 쿼리
    
  ImageCursorAdapter adapter = new ImageCursorAdapter(this, c);
    
  gallery.setAdapter(adapter);        
 }
 
 int x = 0;
 
 class ImageCursorAdapter extends CursorAdapter
 {
  public ImageCursorAdapter(Context context, Cursor c)
  {
   super(context, c);
  }
   
  @Override
  public void bindView(View view, Context context, Cursor cursor)
  {
   ImageView img = (ImageView)view;
     
   long id = cursor.getLong(cursor.getColumnIndexOrThrow(Images.Media._ID));  
     
   final Uri uri = ContentUris.withAppendedId(Images.Media.EXTERNAL_CONTENT_URI, id); //개별 이미지에 대한 URI 생성
    
   try
   {
    Bitmap bm = Images.Media.getBitmap(getContentResolver(), uri); //Bitmap 로드
          
    img.setImageBitmap(bm);
   }catch(Exception e)
   {}
   
   //Intent i = new Intent(Intent.ACTION_VIEW, uri);       
   //startActivity(i);
   /*
   OnClickListener okButtonListener = new OnClickListener(){
                @Override
                public void onClick(DialogInterface arg0, int arg1) {
                          // Lets start an intent to View the file, that was clicked...
                 Photo.this.TransferUri(uri);
                }
            };
            */
   
   x++;
   
   if(x == 3){}
    TransferUri(uri);
  }
  
  @Override
  public View newView(Context context, Cursor cursor, ViewGroup parent)
  {
   ImageView v = new ImageView(context);
     
   v.setLayoutParams(new Gallery.LayoutParams(80, 80)); 
     
   v.setScaleType(ImageView.ScaleType.FIT_CENTER);
    
   return v;
  } 
 }
 
 public void TransferUri(Uri uri)
 {
  Intent myIntent = new Intent(this, EditImage.class);
     //Uri target = Uri.parse("file://" + aFile.getAbsolutePath());
     
     //private string temp = "file://" + aFile.getAbsolutePath();
     
     //myIntent.putExtra("Image_Target", "file://" + aFile.getAbsolutePath());
     //myIntent.putExtra(EditImage.TARGET, "file://" + aFile.getAbsolutePath());
     
  myIntent.setData(uri);
  startActivity(myIntent);
 }
}

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------