package com.android.fipper;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;
import android.app.Activity;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Gallery;
import android.widget.ImageView;
public class Fipper extends Activity {
  /** Called when the activity is first created. */
  
 @Override
    public void onCreate(Bundle icicle) {
        super.onCreate(icicle);
        setContentView(R.layout.main);
        ((Gallery) findViewById(R.id.gallery))
          .setAdapter(new ImageAdapter(this));
    }
    public class ImageAdapter extends BaseAdapter {
     /** The parent context */
        private Context myContext;
        /** URL-Strings to some remote images. */
        private String[] myRemoteImages = {
          "http://imguser.pandora.tv/pandora/_channel_img/t/k/tkdgns1250/bbs_img/1240283638.jpg",
          "http://c.ask.nate.com/imgs/qrsi.php/6304929/8380388/0/1/A/%EC%9B%90%ED%94%BC%EC%8A%A4.jpg",
          "http://cfs11.blog.daum.net/image/31/blog/2008/07/08/21/44/4873610df2c94&filename=%EC%9B%90%ED%94%BC%EC%8A%A46.JPG",
          "http://pds2.egloos.com/pds/1/200608/01/07/d0022107_2026770.gif"
        };
        
        public ImageAdapter(Context c) { this.myContext = c; }
        public int getCount() { return this.myRemoteImages.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(this.myContext);
            try {
    
    URL aURL = new URL(myRemoteImages[position]);
    URLConnection conn = aURL.openConnection();
    conn.connect();
    InputStream is = conn.getInputStream();
    BufferedInputStream bis = new BufferedInputStream(is);
    Bitmap bm = BitmapFactory.decodeStream(bis);
    bis.close();
    is.close();
    i.setImageBitmap(bm);
   } catch (IOException e) {
    i.setImageResource(R.drawable.a);
    Log.e("DEBUGTAG", "Remtoe Image Exception", e);
   }
            
            i.setScaleType(ImageView.ScaleType.FIT_CENTER);
            i.setLayoutParams(new Gallery.LayoutParams(300, 300));
            return i;
        }
        public float getScale(boolean focused, int offset) {
            return Math.max(0, 1.0f / (float)Math.pow(2, Math.abs(offset)));
        }
    }
}


 

갤러리 뷰를 사용해서

웹에서 이미지를 가져와서 출력하게끔 했습니다.


 

질문을 드리자면

저 상태에서 만약 4번째 그림을 선택하여 클릭을 하면

activity가 바뀌면서

선택된 이미지가 전체 화면으로 띄어지게끔 하고싶습니다.

도움 부탁드립니다.