开发者

Using ImageGallery to display images from the SD card?

How would I use ImageGallery to display imag开发者_开发问答es I have saved in a particular location on the sd card?


This should help: http://androidsamples.blogspot.com/2009/06/how-to-display-thumbnails-of-images.html


several ways to to do this, for example

    //Using an array with the names of your stored pics (myPics)


    public View getView(final int position, View convertView, ViewGroup parent) {

    ImageView myImageView = new ImageView(mContext);

            if (convertView != null)
                myImageView  = (ImageView) convertView;
            else
                myImageView  = new ImageView(mContext);

    Bitmap bitmapImage = BitmapFactory.decodeFile("/sdcard/myTempFolfer/" + myPics(position));
    BitmapDrawable drawableImage = new BitmapDrawable(bitmapImage );                
    myImageView.setImageDrawable(drawableImage ); 

    return myImageView;

}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜