On Mar 20, 2:20 pm, Paul Turchenko <paul.turche...@gmail.com> wrote:
> Well, but generally, it's not a solution. Try making your buffer size
> content-length dependent:
>
> totalSize = conn.getContentLength();
> .....
>
> byte data[] = new byte[totalSize/100];
>
> This way you'll get exactly +1% update for download progress. For most
> generic case I would suggets somethig line this:
>
> totalSize = conn.getContentLength();
> .....
>
> tmpBufSize = totalSize/100;
> byte data[] = new byte[tmpBufSize >= 1 ?tmpBufSize:1024];
>
>

yes, but this is also tricky. what if OP database is not 250MB but
500MB? then your data duffer will have 5MB which most likely will
couse OOM error - i would just set data buffer to some 64kB or
something and publishProgress not that often - just after every one
percent of downloaded data

pskink

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

To unsubscribe from this group, send email to 
android-developers+unsubscribegooglegroups.com or reply to this email with the 
words "REMOVE ME" as the subject.

Reply via email to