Making External Images Local

All your problems with Audio, Video and Images.

Making External Images Local

Postby khaled450 » Thu Jun 10, 2010 10:43 pm

I am working on a project that contains lots of images that makes the size of my app more than 30M. So I want to upload all my images on a server and allow the user to download those images to the SD card onclick, I mean when the user click a button to access a certain images it checks first if the image is available on the SD card, if not then download it. However, I am not familiar with some ideas
1. Creating a file on the SD card that is accessible by my app.
2. Establishing an active link to download a media to a certain file on the SD card.

and some other privacy issues that I wont bug you with.
Junior Developer
Junior Developer
Posts: 21
Joined: Wed May 19, 2010 8:11 am


Re: Making External Images Local

Postby dinamic » Fri Jun 11, 2010 6:34 am


1. Sdcard are accessed under /sdcard path so just use a"/sdcard/myapp/cache/imgid.jpg").exists() and standard java file io routines...

2. Something like:
URL u = new URL("http://www.somewhere.else/getimg.php?id=234");
HttpURLConnection c = (HttpURLConnection) u.openConnection();
FileOutputStream f = new FileOutputStream(new File("/sdcard/myapp/cache/imageid.jpg"));
InputStream in = c.getInputStream();

then read in and write to f...

Posts: 8
Joined: Thu Jun 10, 2010 2:31 pm


Return to Multimedia Problems

Who is online

Users browsing this forum: No registered users and 4 guests