I am developing Android Twitter application. I downloaded TwitterClient Demo deom net. But there is a class file "android.net.http.RequestQueue" that is not available in sDK component in android.jar. Please advise on the same.
+1
A:
It depends from where you have downloaded that Twitter demo example:
- originally, there was an old 2007 demo
- a new zip from October 2008 in this post
- a snippet from 2009 with the following comment:
android.net.http.RequestQueue
is not an official part of the Android API, so it might go away or change in a future release.
You can tell by the{@hide}
in the class-level JavaDoc comment inRequestQueue.java
.
So if the recent APIs don't have this class at all anymore, you can fall back on HttpURLConnection
, as in this thread.
It seems safer to use the good ol'
HttpURLConnection
for HTTP calls then.
I suppose theRequestQueue
was offered to save us the effort of spawning a separate thread before making the HTTP calls.
See the two approaches illustrated in this tutorial here.
VonC
2010-05-15 08:20:37