通过webservice获取图像链接时出错

时间:2014-06-11 16:03:01

标签: android web-services android-imageview

我试图通过网络服务获取图片链接并将其添加到我的自定义列表视图中。

当我将Image-View设置为直接链接时,这项工作正常,但是当我通过Web服务提供图像链接时,然后设置图像视图返回错误并说:

 Caused by: java.lang.IllegalArgumentException: Illegal character in scheme at index 0:  http://www.babynameslog.com/wp-content/uploads/2013/12/baby-girl-names-2014.jpg

其他错误:

 FATAL EXCEPTION: AsyncTask #2
 java.lang.RuntimeException: An error occured while executing doInBackground()
 at android.os.AsyncTask$3.done(AsyncTask.java:299)
 at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:352)
 at java.util.concurrent.FutureTask.setException(FutureTask.java:219)
 at java.util.concurrent.FutureTask.run(FutureTask.java:239)
 at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
 at java.lang.Thread.run(Thread.java:841)
 Caused by: java.lang.IllegalArgumentException: Illegal character in scheme at index 0:  http://www.babynameslog.com/wp-content/uploads/2013/12/baby-girl-names-2014.jpg
 at java.net.URI.create(URI.java:727)
 at org.apache.http.client.methods.HttpGet.<init>(HttpGet.java:75)

我应该怎么做?

1 个答案:

答案 0 :(得分:1)

您似乎在http:前面有一些空白,删除它们。

GET_IMAGE =“http://www.babynameslog.com/wp-content/uploads/2013/12/baby-girl-names-2014.jpg”;