-4

Possible Duplicate:
Android: How to store images from url & save it in SD card

I parse a xml file from web

and it has a picture url like this: http://xxxxxx.jpg

then I use a

private String url_picture = "http://xxxxx.jpg";

I want to store the picture in to the device

How can I do?

Community
  • 1
  • 1
user1531240
  • 875
  • 1
  • 11
  • 20

1 Answers1

1

I wrote this code to receive image from an url. And if you check this link it tells you how to save it on sd-card Store Bitmap image to SD Card in Android

private Bitmap getBitmap(String str, Options options) {
    // TODO Auto-generated method stub
    Bitmap bm = null;
    InputStream inStream = null;
    try {
        inStream = HttpConnection(str);
        bm = BitmapFactory.decodeStream(inStream, null, options);
        inStream.close();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    return bm;
}
Community
  • 1
  • 1
barisemreefe
  • 434
  • 4
  • 11