我正在开发 Android Twitter 应用程序。我下载了 TwitterClient Demo deom net。 但是在android.jar中的sDK组件中有一个class文件“android.net.http.RequestQueue”是没有的。请就此提出建议。
最佳答案
这取决于您从何处下载了该 Twitter 演示示例:
- 最初,有一个 old 2007 demo
- 一个new zip from October 2008在 this post
- 一个snippet from 2009评论如下:
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
.
因此,如果最近的 API 不再有此类,您可以回退到 HttpURLConnection
,如 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.
参见 this tutorial here 中说明的两种方法.
关于在 andorid.jar 中找不到 android.net.http.RequestQueue,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2839366/