使用ImageGallery显示SD卡中的图像?

时间:2010-08-05 14:36:14

标签: android

我如何使用ImageGallery显示我保存在SD卡上特定位置的图像?

2 个答案:

答案 0 :(得分:0)

答案 1 :(得分:0)

有几种方法可以做到这一点,例如

    //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;

}