[android-developers] Re: how can i put 15MB images in my App?

2009-06-10 Thread Robert Green

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  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  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  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 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
-~--~~~~--~~--~--~---



[android-developers] Re: how can i put 15MB images in my App?

2009-06-10 Thread Jonathan W

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  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  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 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
-~--~~~~--~~--~--~---



[android-developers] Re: how can i put 15MB images in my App?

2009-06-10 Thread Jonathan W

Hi, I have the same question as below.  I'd like my app to prompt the
user to download a package of 500 png images upon first load.  These
images would be stored on the SD card (and ideally encrypted), but
accessed by the heard of the application which would be stored in main
memory.

Can anyone provide some guidance on how to do this?

Thanks,
Jonathan



On May 29, 7:57 am, zeeshan  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  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 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
-~--~~~~--~~--~--~---



[android-developers] Re: how can i put 15MB images in my App?

2009-05-29 Thread zeeshan

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  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 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 on sd card. 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
-~--~~~~--~~--~--~---



[android-developers] Re: how can i put 15MB images in my App?

2009-05-21 Thread Mike Hearn

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  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 on sd card. 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
-~--~~~~--~~--~--~---



[android-developers] Re: how can i put 15MB images in my App?

2009-05-21 Thread Streets Of Boston

There may be no restriction on any apk, but i wouldn't put them all in
one apk anyway.

Giving the fact that you can only install your app on phone-memory
(not on your SD-card), it's likely that users see the more than
15MByte size of your app and decide not to install/buy it.

Is downloading these images an option?

On May 21, 12:35 pm, Dianne Hackborn  wrote:
> You can put them in your .apk without restriction, just don't load them all
> at the same time.
>
> On Thu, May 21, 2009 at 7:59 AM, zeeshan  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 on sd card. i need to put them in my
> > assets.
>
> > is it something that can not be achieved in android?
>
> --
> Dianne Hackborn
> Android framework engineer
> hack...@android.com
>
> Note: please don't send private questions to me, as I don't have time to
> provide private support, and so won't reply to such e-mails.  All such
> questions should be posted on public forums, where I and others can see and
> answer them.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[android-developers] Re: how can i put 15MB images in my App?

2009-05-21 Thread Dianne Hackborn
You can put them in your .apk without restriction, just don't load them all
at the same time.

On Thu, May 21, 2009 at 7:59 AM, zeeshan  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 on sd card. i need to put them in my
> assets.
>
> is it something that can not be achieved in android?
> >
>


-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---