开发者

Using ImageGallery to display images from the SD card?

开发者 https://www.devze.com 2023-01-10 04:04 出处:网络
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-thumbnail

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

精彩评论

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

关注公众号