onStart {
  boolean hasAllImages = checkSDForImages();
  if (!hasAllImages) {
    startProgress("Please wait, downloading app data");
    downloadMissingImages();
    endProgress();
  }
}

The idea here is that checkSDForImages is a quick scan of the file
system to make sure all 500 images are there.  Imagine that many users
will interrupt the download, because people tend to do those sorts of
things for various reasons - so make sure that your code to download
only downloads ones that aren't there.  If you want to get fancy,
create MD5s of the files on your server so that you can check your
local files against those signatures to guarantee that the files are
100% in tact and not corrupt.

To download, I recommend just using plain old HTTP.  The HTTP library
with Android is fairly easy and straightforward to use.  I implemented
a REST service using it with JSON but you can get away with just doing
GETs on the files you need.  Probably any webserver will work fine
with that.

Make sure to run your download in another thread.

I'm not sure specifically how to write to the SD but it can't be that
hard.  Once you're at that point, I'd ask that as a very specific
question and I'm sure you'll get an answer.

On Jun 9, 10:06 pm, Jonathan W <jwege...@gmail.com> wrote:
> I've got the same question.  On first load, I want to download images
> to SD card for use later.  Any suggestions?
>
> On May 29, 7:57 am, zeeshan <genx...@gmail.com> wrote:
>
> > i think download option would be the better solution.
> > i need to download in a bunch like 50 images on next click.
>
> > i only have idea to take image and display with fowllowing approach:
>
> > private static Bitmap getImageBitmap(String url) {
> >         Bitmap bm = null;
> >         try {
> >             URL aURL = new URL(url);
> >             URLConnection conn = aURL.openConnection();
> >             conn.connect();
> >             InputStream is = conn.getInputStream();
> >             BufferedInputStream bis = new BufferedInputStream(is);
> >             bm = BitmapFactory.decodeStream(bis);
> >             bis.close();
> >             is.close();
> >        } catch (IOException e) {
> >           e.printStackTrace();
> >        }
> >        return bm;
> >     }
>
> > /////////////////////
>
> > this just load image from my url, may be in cache .
>
> > can u please provide any solution to download my files from url and
> > put them in my apk to use it later
>
> > thanks for your time and help, waiting for the reply
>
> > On May 21, 8:38 pm, Mike Hearn <mh.in.engl...@gmail.com> wrote:
>
> > > You can encrypt the files on the sdcard. Just be aware that using the
> > > sdcard carries with it some taxes, eg, you have to handle  it being
> > > taken out whilst in use ....
>
> > > On May 21, 4:59 pm,zeeshan<genx...@gmail.com> wrote:
>
> > > > Hi,
>
> > > > i am afraid if Max space for android App is 14MB , how can i put 15MB
> > > > images in my App.
> > > > my application includes more than 500 PNG images which are
> > > > confidentials and cann't be put onsdcard. i need to put them in my
> > > >assets.
>
> > > > is it something that can not be achieved in android?
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to