AsyncTask and simultaneous network downloads

by Jason Proctor » Fri, 29 Jan 2010 05:02:26 GMT


Sponsored Links
 i hope not, because the code makes a new HttpClient instance per 
ArtRetrievalTask. i suppose it could be trying to be clever, 
realising that the requests are going to the same place, and 
utilising HTTP 1.1 to bundle the requests into the same connection.


if that's really what's happening (and i suspect not, somehow), and 
maybe only the server logs can tell for sure, then i hereby state for 
the 67th time how happy i am that i dumped HttpClient and rolled my 
own HTTP.



Perhaps the requests are being serialized by HttpClient? I wonder if there's a way to determine the actual thread a particular AsyncTask's doInBacground process runs on, like maybe a thread id? --



AsyncTask and simultaneous network downloads

by Jason Proctor » Fri, 29 Jan 2010 05:29:21 GMT


 the main HttpClient showstopper for me was its buggy cookie 
implementation - i needed to share cookies between WebKit and 
HttpClient, and HttpClient wouldn't play nice. however, i also 
thought the API was awkward to use. last thing, i took a look at the 
code. someone really managed to turn something relatively simple into 
a gothic monstrosity.


so i wrote my own (simple) HTTP implementation on top of 
java.net.Socket. it's very simple and doesn't support any fruity 
options, but it integrates with my progress reporting system, and 
automatically shares cookies with WebKit. it has a pluggable content 
handler system so you can easily get binary, JSON, strings, etc, from 
resources with one line of code.


my apps now depend on it -- i use it from within AsyncTasks all the 
damn time and it's solid.




Jason, Rolled your own? Can you share/elaborate? There seems to be other issues with HttpClient. I am looking at either integrating Jersey/JAX-B client side to send REST calls (my server side is all Jersey/JEE6/JAXB based), but if that is too bulky for the app, then I was looking at using URLConnection.. but I haven't tried using that for REST calls with Basic Auth, various headers, xml/json body, etc. On Thu, Jan 28, 2010 at 1:01 PM, Jason Proctor <<mailto:jason.android.li...@gmail.com>jason.android.li...@gmail.com> i hope not, because the code makes a new HttpClient instance per ArtRetrievalTask. i suppose it could be trying to be clever, realising that the requests are going to the same place, and utilising HTTP 1.1 to bundle the requests into the same connection. if that's really what's happening (and i suspect not, somehow), and maybe only the server logs can tell for sure, then i hereby state for the 67th time how happy i am that i dumped HttpClient and rolled my own HTTP. Perhaps the requests are being serialized by HttpClient? I wonder if there's a way to determine the actual thread a particular AsyncTask's doInBacground process runs on, like maybe a thread id? --


Sponsored Links


AsyncTask and simultaneous network downloads

by Jason Proctor » Fri, 29 Jan 2010 05:46:41 GMT


 it belongs to my employer, so i can't. i would rewrite it at home and 
share it, but really i'd rather work on music at home.


just take a day and do it yourself. it's not so bad. and you'll thank 
yourself every day like i do :-)





Awesome.. share the code. :) On Thu, Jan 28, 2010 at 1:28 PM, Jason Proctor <<mailto:jason.android.li...@gmail.com>jason.android.li...@gmail.com> the main HttpClient showstopper for me was its buggy cookie implementation - i needed to share cookies between WebKit and HttpClient, and HttpClient wouldn't play nice. however, i also thought the API was awkward to use. last thing, i took a look at the code. someone really managed to turn something relatively simple into a gothic monstrosity. so i wrote my own (simple) HTTP implementation on top of java.net.Socket. it's very simple and doesn't support any fruity options, but it integrates with my progress reporting system, and automatically shares cookies with WebKit. it has a pluggable content handler system so you can easily get binary, JSON, strings, etc, from resources with one line of code. my apps now depend on it -- i use it from within AsyncTasks all the damn time and it's solid. Jason, Rolled your own? Can you share/elaborate? There seems to be other issues with HttpClient. I am looking at either integrating Jersey/JAX-B client side to send REST calls (my server side is all Jersey/JEE6/JAXB based), but if that is too bulky for the app, then I was looking at using URLConnection.. but I haven't tried using that for REST calls with Basic Auth, various headers, xml/json body, etc. On Thu, Jan 28, 2010 at 1:01 PM, Jason Proctor <<mailto:<mailto:jason.android.li...@gmail.com>jason.android.li...@gmail.com><mailto:jason.android.li...@gmail.com>jason.android.li...@gmail.com> i hope not, because the code makes a new HttpClient instance per ArtRetrievalTask. i suppose it could be trying to be clever, realising that the requests are going to the same place, and utilising HTTP 1.1 to bundle the requests into the same connection. if that's really what's happening (and i suspect not, somehow), and maybe only the server logs can tell for sure, then i hereby state for the 67th time how happy i am that i dumped HttpClient and rolled my own HTTP. Perhaps the requests are being serialized by HttpClient? I wonder if there's a way to determine the actual thread a particular AsyncTask's doInBacground process runs on, like maybe a thread id? --



Other Threads

1. Can Android 2.2 OS support multiple display screens?

Everything I have read so far points to the OS not yet being coded to
support multiple display screens (http://developer.android.com/guide/
practices/screens_support.html).

The reason I am inquiring is because some of the devices that support
Android 2.2 (like Motorola Atrix 4G) have native support for XenApp or
RDP client.

Microsoft Remote Desktop client (Version 6.0 and up) supports spanning
across multiple monitors. Also Xen App Server (version 6.0 and up)
allows a Citrix Multi-Monitor ICA session to act like native windows
workstations using Multi-Monitor configurations.

Since Android 2.0 the ability to connect an android device to an
external display (monitor/projector) through a HDMI or similar port
has been available. Multiple displays would be the next natural
evolution I think in bridging the gap between android devices and
netbooks or tablets as a mobility solution. The hardware is almost
there, right now it seems to be just an OS limitation.

-- 

2. BadParcelableException: lost CREATOR?

Hi list

My class implements Parcelable and does have a public static Parceleble.Creator 
object called CREATOR.
Somehow I got a crash report in market with the following:

android.os.BadParcelableException: Parcelable protocol requires a 
Parcelable.Creator object called CREATOR on class my.class.Name
at android.os.Parcel.readParcelable(Parcel.java:1905)
at android.os.Parcel.readValue(Parcel.java:1784)
at android.os.Parcel.readMapInternal(Parcel.java:2021)
at android.os.Bundle.unparcel(Bundle.java:208)
at android.os.Bundle.containsKey(Bundle.java:249)

This occurred while trying to restore an object from the saved instance state 
after the os reclaimed memory.

Is it possible that my creator also got reclaimed?
Did reflection fail?
Has anyone experienced anything similar?

Thanks

-- 

3. RFID tag detection

4. Sending GPS coordinates

5. Scratch Guard for iPhone, ipad and Others

6. Connectand send data from 2 bluetooth devices to the android mobile

7. Eclipse and Android source code